如何在Google Play商店中订购包含本机库的多个APK?

时间:2015-07-28 02:28:03

标签: android-ndk google-play

我的应用程序使用4个本机库(armeabi,armeabi-v7a,x86,mips)。我使用此订购的版本代码以4个单独的APK上传到Google Play商店:

  • armeabi-v7a 104
  • armeabi 103
  • x86 102
  • mips 101

在Google Play商店中,我收到了此警告消息:

Some devices with Native platforms containing any of [x86] are eligible to receive version 102, which is better optimized for the device's Native Platform, but actually receive version 104 because it has a higher version code and the device supports Native platforms containing any of [armeabi-v7a] either directly (e.g. ARMv7 devices support a superset of ARMv5TE instructions) or indirectly (e.g. some x86 devices support ARMv7 or ARMv5TE via native code translation). This would occur when 
API levels in range 7+ and 
Screen layouts containing any of [small, normal, large, xlarge] and 
Features containing all of [android.hardware.TOUCHSCREEN].
Some devices with Native platforms containing any of [x86] are eligible to receive version 102, which is better optimized for the device's Native Platform, but actually receive version 103 because it has a higher version code and the device supports Native platforms containing any of [armeabi] either directly (e.g. ARMv7 devices support a superset of ARMv5TE instructions) or indirectly (e.g. some x86 devices support ARMv7 or ARMv5TE via native code translation). This would occur when 
API levels in range 7+ and 
Screen layouts containing any of [small, normal, large, xlarge] and 
Features containing all of [android.hardware.TOUCHSCREEN].
Some devices are eligible to run multiple APKs. In such a scenario, the device will receive the APK with the higher version code.

我的版本代码订单是否错误?什么应该是一个好的订单?

1 个答案:

答案 0 :(得分:0)

在您的示例中,您需要按如下方式订购ABI:

  • armeabi 101
  • armeabi-v7a 102
  • mips 103
  • x86 104

注意:您仍然会收到警告某些设备有资格运行多个APK ,因为它是真的,armeabi-v7a设备也可以运行armeabi版本,但会安装最高版本的APK

将armeabi(101)作为比armeabi-v7a(102)更低的版本非常重要,否则你的armeabi-v7a设备将安装armeabi版本并且性能会很差。同样重要的是x86是比armeabi-v7a更高的版本,因为x86可能(或可能不)支持armeabi-v7a。

您可以考虑将ABI代码添加为版本的前缀(如下图所示)。这允许您发布一个ABI的更新,而无需更新所有APK。

Order of ABI versioning

这些版本号可以在Android gradle build中自动生成。

project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, 'mips': 5, 'mips64': 6, 'x86': 8, 'x86_64': 9]

android.applicationVariants.all { variant ->
        variant.outputs.each { output ->
            output.versionCodeOverride =
                project.ext.versionCodes.get(output.getFilter(
                    com.android.build.OutputFile.ABI), 0) * 10000000 + android.defaultConfig.versionCode
    }
}

您可以在我发布的this article中了解有关如何实施此版本控制系统的更多信息。

有关使用本机库部署应用程序的更多信息,请访问here

可以找到有关Android构建系统中ABI Splits的文档here