【问题标题】:No split apks compatible with Android emulator没有与 Android 模拟器兼容的拆分 apk
【发布时间】:2018-01-30 19:56:28
【问题描述】:

我有一个 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 中执行以下操作来避免使用拆分 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?我可以使用哪些工具进行更深入的挖掘?

【问题讨论】:

    标签: android gradle android-ndk


    【解决方案1】:

    你试试这个方法

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

    并尝试设置

    universalApk false
    

    【讨论】:

      【解决方案2】:

      经过仔细检查,我犯了一个错误,即在我的 abi 拆分列表中不包括 x86。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-07-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-11-24
        相关资源
        最近更新 更多