Android NDK 和 Google Play 过滤 [英] Android NDK and Google Play filtering

查看:23
本文介绍了Android NDK 和 Google Play 过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google Play 应用商店会自动将您的应用过滤到具有兼容 CPU 架构的设备.例如.如果您有一个仅针对 ARMv5 编译的库,则您的应用将仅在配备 ARMv5 或 ARMv7 处理器的设备上显示.

The Google Play appstore automatically filters your application to devices with compatible CPU architecture. E.g. if you have a library which is only compiled for ARMv5, your app will only show up for devices with ARMv5 or ARMv7 processors.

如果我有 Java 替代品,并且希望我的应用也能被非 ARM 设备下载,该怎么办?例如.我在尝试加载外部库时捕捉到异常,并在 Dex 字节码 (Java) 中实现了一个可行的替代方案.

What if I have a Java alternative, and want my app to be downloaded by non-ARM devices too? E.g. I catch an exception when trying to load the external library, and implement a workable alternative in Dex bytecode (Java).

当我上传 .apk 时,Android 开发者控制台显示:此 apk 请求 1 个将用于 Google Play 过滤的本机平台.armeabi"

When I upload the .apk, the Android Developer Console says: "This apk requests 1 native platforms that will be used for Google Play filtering. armeabi"

我需要为 x86 和 MIPS 编译虚拟库吗?然后在我的 Java 代码中,检查处理器架构以了解我是否可以实际使用该库?应该有更好的解决方案.

Do I need to compile dummy libraries for x86 and MIPS? Then in my Java code, check the processor architecture to know if I can actually use the library? There should be a better solution.

据我所知,Manifest 中没有关于 CPU 架构的任何内容,我无法在开发者控制台中找到关闭此过滤器的方法.

As far as I know, there is nothing in the Manifest about CPU architecture, and I cannot find a way in the Developer Console to turn this filter off.

希望有人比我更了解 Google Play 过滤和 NDK 知道答案.

Hopefully somebody who knows a lot more than I do about Google Play filtering and the NDK knows the answer.

推荐答案

虽然捕获 loadLibrary 失败可以在任何设备上工作(至少我尝试过的所有设备,包括 GTV),但如果出现以下情况,Play 商店将不会在设备上显示apk 中不存在该平台的 ABI.

While trapping for loadLibrary failures will work on any device (at least all that I have tried including GTVs), but the Play Store will not show on devices if the ABI for that platform does not exist in the apk.

来自文档(http://developer.android.com/guide/appendix/market-filters.html ):包含针对特定平台(例如 ARM EABI v7 或 x86)的本机库的应用程序仅在支持该平台的设备上可见.

From the docs ( http://developer.android.com/guide/appendix/market-filters.html ): An application that includes native libraries that target a specific platform (ARM EABI v7 or x86, for example) are visible only on devices that support that platform.

理论上,针对所有平台的构建将能够针对所有设备,但实际上有些设备(例如 Google Tv)报告没有 ABI,这意味着只有没有本机代码的 apk 才会出现在 Play 商店中在这些设备上.您可以使用多个 apk,但是,1 个没有本机代码,1 个用于支持您的本机代码的所有平台.

In in theory, building for all platforms would be able to target all devices, but in practice there are some devices like Google Tv that report no ABI, which means that only apks that have no native code will appear in the Play Store on those devices. You can use multiple apks, however, 1 with no native code and 1 with all platforms that support your native code.

您可以在此处阅读有关多 apk 支持的信息:http://developer.android.com/指南/市场/发布/multiple-apks.html

You can read about multiple apk support here: http://developer.android.com/guide/market/publishing/multiple-apks.html

这篇关于Android NDK 和 Google Play 过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆