I’m writing an app that needs some JNI code.
This code involves floating point processing, so I want it to be as fast as it can be. Therefore I want to support ARM5 and ARM7 architectures. In my Application.mk it says:
APP_ABI := all
… and the build process compiles the module for ARM5, ARM7 and x86. I verified that all .so files end up in the .apk file.
Now the question is: Will Android automatically load the “best” .so file depending on the platform it is running on? In other words: Will it load the ARM5 module on ARM5 devices and ARM7 on ARM7 devices?
Yes.
On an ARMv5 or ARMv6 device (CPU), the ARMv5 binary will be used (APP_ABI = armeabi)
On an ARMv7 device, the system will see the ARMv7 binary is available and will use it (APP_ABI = armeabi-v7a)
In the NDK documentation, we can read :