没有与Android模拟器兼容的拆分apks

时间:2018-01-30 19:56:28

标签: android gradle android-ndk

我有一个NDK项目,我正在为armeabi-v7a,arm64-v8a和x86构建。在手机上运行代码工作正常,但尝试在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中执行以下操作来避免使用split apks:

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生成并且它不兼容,所以我想错误的生成了吗?我可以用什么工具深入挖掘?

2 个答案:

答案 0 :(得分:0)

你试试这种方式

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

并尝试设置

universalApk false

答案 1 :(得分:0)

我犯了一个错误,即在仔细检查后不在我的abi分裂列表中包含x86。