我正在写一个需要一些JNI代码的应用程序。这段代码涉及浮点处理,所以我希望它尽可能快。因此,我希望支持ARM5和ARM7架构。在我的Application.mk中,它说:
APP_ABI := all
..。构建过程编译ARM5、ARM7和x86的模块。我验证了所有.so文件最终都在.apk文件中。
现在的问题是:安卓会根据它运行的平台自动加载“最好的”.so文件吗?换句话说:它会在ARM5设备上加载ARM5模块,在ARM7设备上加载ARM7吗?
发布于 2012-02-07 23:00:28
是。
在ARMv5或ARMv6设备上,将在ARMv7设备上使用ARMv5二进制文件(APP_ABI = armeabi),系统将看到ARMv7二进制文件可用并将使用它(APP_ABI = armeabi-v7a)
在NDK文档中,我们可以阅读:
III.2. Android Platform ABI support:
------------------------------------
The Android system knows at runtime which ABI(s) it supports. More
precisely, up to two build-specific system properties are used to
indicate:
- the 'primary' ABI for the device, corresponding to the machine
code used in the system image itself.
- an optional 'secondary' ABI, corresponding to another ABI that
is also supported by the system image.
For example, a typical ARMv5TE-based device would only define
the primary ABI as 'armeabi' and not define a secondary one.
On the other hand, a typical ARMv7-based device would define the
primary ABI to 'armeabi-v7a' and the secondary one to 'armeabi'
since it can run application native binaries generated for both
of them.
A typical x86-based device only defines a primary abi named 'x86'.
https://stackoverflow.com/questions/8118552
复制相似问题