设备支持但apk仅支持armeabi-v7 x86的原因是什么?

时间:2019-02-19 04:57:13

标签: android gradle

每当我尝试运行该应用程序时,都会给我一个错误:-设备支持,但apk仅支持armeabi-v7 x86

它工作得很好,但是突然之间它开始出现此错误。谁能帮我这个忙吗? 我在项目中使用了ndk。我无法从gradle中删除任何内容。我该怎么办才能消除此错误?

这是build.gradle文件:-

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 27
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.silvershield"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 3
        versionName "1.0"
        multiDexEnabled true
        buildConfigField "String", "DEFAULT_SERVICE_NAME", "\"ZeRXconf\""
        buildConfigField "String", "DEFAULT_SERVICE_TYPE", "\"_ipp._tcp.\""
        buildConfigField "String", "DEFAULT_SERVICE_PORT", "\"1234\""
        ndk {
           // abiFilters "armeabi-v7a"
            abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
        }
    }


    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
    packagingOptions {
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/notice'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license'
        exclude 'META-INF/license.txt'
    }
    dexOptions {
        preDexLibraries = false
    }
    dataBinding {
        enabled = true
    }
}

dependencies {
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support:support-v4:27.1.0'
    implementation 'com.android.support:cardview-v7:27.1.0'
    implementation 'com.jakewharton:butterknife:8.5.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
    implementation 'com.squareup.retrofit2:retrofit:2.1.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.kbeanie:multipicker:1.1.31@aar'
    implementation 'pub.devrel:easypermissions:0.1.9'
    implementation 'com.google.android.gms:play-services:12.0.1'
    implementation 'com.google.firebase:firebase-messaging:12.0.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
    implementation 'com.github.jkwiecien:EasyImage:2.1.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
    implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
    implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true;
    }
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation project(':zerxconf')
    implementation project(':library')
    implementation project(':YouTubePlayer')
    implementation project(':PDF417Scanner')
    // implementation files('libs/mwbscanner.jar')
    implementation(name: 'cmbsdklib-release', ext: 'aar')
    implementation files('libs/commons-io-2.4.jar')
    implementation files('libs/BrotherPrintLibrary.jar')
    implementation files('libs/idscan_android_lib.jar')
    implementation files('libs/dlparserlib.jar')
}
apply plugin: 'com.google.gms.google-services'

这是屏幕截图 enter image description here

1 个答案:

答案 0 :(得分:1)

android下,定义拆分以生成特定于体系结构的和/或通用的APK,大致如下:

splits {
    abi {
        enable true
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk true  // If true, also generate a universal APK
        include "armeabi", "armeabi-v7a", "x86", "mips"
    }
}

其中enableSeparateBuildPerCPUArchitecture定义为:

def enableSeparateBuildPerCPUArchitecture = true