NDK版本与Android版本之间的关系 [英] Relation between the NDK version and the Android version

查看:321
本文介绍了NDK版本与Android版本之间的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用于编译本机代码的NDK版本与在装有APK的设备上运行的Android版本之间是否存在任何关系(约束/兼容性限制)?
例如,我使用Android NDK r7编译本机代码,获取库并生成APK1;然后我使用NDK r10d进行编译,获取库并生成APK2.

Is there any relation (constraint/compatibility restriction) between the version of the NDK used to compile the native code and the Android version running on the device where the APK is installed?
For example, I compile the native code with Android NDK r7, I get the libraries and generate APK1; then I compile with NDK r10d, obtain the libraries and generate APK2.

在同一设备上运行的APK1和APK2之间可能会出现不同的行为吗?

Is it any risk that I might get different behavior between APK1 and APK2 running on the same device?

推荐答案

在NDK中发现并修复了错误.因此,更高版本通常更好.但是错误可能会在更高版本中引入,因此请继续跟踪论坛(例如 SO 问题,并随时准备升级.

Bugs are found and fixed in NDK. So the later versions are generally better. But bugs may be introduced in later versions, so keep tracking the forums (e.g. SO and groups/android-ndk), track issues, and be ready to upgrade at any time.

NDK中包含的编译器会随着时间的推移而不断改进,包括进行优化.因此,更高版本的文件可能会生成更快的可执行文件.

The compilers included in NDK improve with the time, including optimizations. So, later versions may produce faster executables.

此外,尽管64位系统可以运行32位可执行文件,但更高版本的NDK可以生成本机64位二进制文​​件,在此类设备上将更快.

Also, while the 64-bit systems can run 32-bit executables, later NDK versions can produce native 64 bit binaries that will be much faster on such devices.

不要将NDK版本与平台混淆!甚至r.10e都支持所有较旧的平台,但是如果您为 android-21 构建应用,则不会在具有 Froyo 的设备上加载该应用.另一方面,前向可比性通常还可以,并且大多数为 android-9 构建的程序都可以在所有最新设备上运行,但是可能会出现故障,并且这些二进制文件可能无法充分利用新平台,因此比为最高平台编译的效率低.

Don't confuse the NDK release with the platform! Even r.10e has support for all older platforms, but if you build your app for android-21, it won't load on devices with Froyo. On the other hand, forward comparability is usually OK, and mostly programs built for android-9 will run on all newest devices, but there may be glitches, and such binaries may underutilize the new platform, and be less efficient than the ones compiled for the highest platform.

这篇关于NDK版本与Android版本之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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