【问题标题】:What is the reason for device supports but apk only supports armeabi-v7 x86?设备支持但apk只支持armeabi-v7 x86的原因是什么?
【发布时间】:2019-02-19 04:57:12
【问题描述】:

当我尝试运行该应用程序时,它会给我一个错误:- 设备支持但 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'

这是截图

【问题讨论】:

    标签: android gradle


    【解决方案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
    

    【讨论】:

    • 它给出了某种错误无法为 com.android.build.gradle.internal.dsl.AbiSplitOptions 类型的对象获取未知属性“enableSeparateBuildPerCPUArchitecture”。
    • 抱歉,我已将其添加到我的帖子中。
    猜你喜欢
    • 2018-01-05
    • 1970-01-01
    • 2017-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多