android - 没有与Android模拟器兼容的拆分APK

标签 android gradle android-ndk

我有一个要为armeabi-v7a,arm64-v8a和x86构建的NDK项目。在电话上运行代码可以正常工作,但是尝试在x86模拟器上运行会正确构建,但是会出现以下错误:
The currently selected variant "debug" uses split APKs, but none of the 1 split apks are compatible with the current device with density "560" and ABIs "x86".
最初,我尝试通过在build.gradle中执行以下操作来避免使用拆分apk:

splits {

    // Configures multiple APKs based on screen density.
    density {

        // Configures multiple APKs based on screen density.
        enable false
    }

    // Configures multiple APKs based on ABI
    abi {
        // Enables building multiple APKs per ABI.
        enable true

        // By default all ABIs are included, so use reset() and include to specify that we only
        // want APKs for armeabi-v7a, arm64-v8a, and x86

        // Resets the list of ABIs that Gradle should create APKs for to none.
        reset()

        // Specifies a list of ABIs that Gradle should create APKs for.
        include 'armeabi-v7a', 'arm64-v8a', 'x86'

        // Specifies that we do not want to also generate a universal APK that includes all ABIs.
        universalApk true
    }
}

但是重新读取错误后,它说没有1个拆分的APK。只有1个APK生成且不兼容,因此我猜生成的是错误的APK?我可以使用哪些工具进行更深入的研究?

最佳答案

你这样尝试

  include 'x86', 'armeabi-v7a', 'armeabi'

并尝试设置
universalApk false

关于android - 没有与Android模拟器兼容的拆分APK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48529521/

相关文章:

gradle - Kotlin gradle build 对 kotlin-stdlib 函数的未解析引用

testing - Gradle:如何在控制台实时显示测试结果?

android - 如何获取任意矩阵的缩放值?

android - Android 上的 OpenCV - 标题;没有那个文件/目录

java - 在 gradle 中定义不打包的编译依赖项

c++ - Android ndk编译SoundTouch Library报错

android - Android 中对 'cv::initModule_nonfree()' 的 undefined reference

android - Robotium ClickOnButton(int ID) 方法导致 "junit.framework.AssertionFailedError: Button with index 2131034130 is not available!"

android - 在android中请求权限代码

Android.mk,包含所有 cpp 文件