Android ndk 如何在Google Play Store中使用本机库订购多个APK?

Android ndk 如何在Google Play Store中使用本机库订购多个APK?,android-ndk,google-play,Android Ndk,Google Play,我的应用程序使用4个本机库(armeabi、armeabi-v7a、x86、mips)。我在4个单独的APK中上传到Google Play商店,版本代码顺序如下: armeabi-v7a 104 Armiabi 103 x86 102 mips 101 在Google Play商店中,我收到了以下警告信息: Some devices with Native platforms containing any of [x86] are eligible to receive version 10

我的应用程序使用4个本机库(armeabi、armeabi-v7a、x86、mips)。我在4个单独的APK中上传到Google Play商店,版本代码顺序如下:

  • armeabi-v7a 104
  • Armiabi 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.

我的版本代码顺序是否不正确?那么什么是好的订单呢?

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

  • Armiabi 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

这些版本号可以在Android gradle构建中自动生成

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
    }
}
您可以在我已发布的文章中阅读有关如何实现此版本控制系统的更多信息

可以找到有关使用本机库部署应用程序的更多信息


在Android构建系统中可以找到关于ABI拆分的文档。

我自己还没有这样做,但是如果您想避免x86用户获得ARM版本并使用二进制代码转换器(例如libhoudini)运行它,那么为x86版本提供最高版本代码似乎是个好主意.当你可以上传一个APK时,为什么要将ABI分成不同的APK?因为库太大了。它可以制作一个65米大小的APK。@Michael我会试试这个。@Michael最好将最高版本代码设置为x86。只有此消息仍然是“某些设备有资格运行多个APK。在这种情况下,设备将接收具有更高版本代码的APK”。