The situation is as follows:
I have a 64 bit apk which should a 32bit shared object(.so file) from /system/lib
. But the apk crashes when running and reports:
UnsatisfiedLinkError nativeLibraryDirectories=[/vendor/lib64, /system/lib64
I think it tries to search my .so file which is located in /system/lib
from /system/lib64, then error happens.
How could I make it search from /system/lib
instead of /system/lib64
?
This is happening because you are bundling at least one 64-bit native library. Android detects this and decides to seek out the rest of the .so files in 64-bit only locations. It doesn't find them because you are only building for 32-bit architectures.
To verify that this is your problem, open up the built apk and look in the "lib" dir. Each subdirectory therein represents a native binary architecture. If you are not building all of the native .so files for that architecture, the directory shouldn't be there. Find out why it is and stop it.
One example of this is Crashlytics which can quietly bundle itself. The resulting crash only appears on 64-bit devices because 32-bit devices never search 64-bit architecture directories.
You have to prune the architectures you are not fully supporting from all your third party middleware.
If you have only x86 and armeabi-v7a libraries, your app should automatically be installed in "32-bit mode".
Try to use this in your gradle file:
android { .... defaultConfig { .... ndk { abiFilters "armeabi-v7a", "x86" } } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With