As stated in Android ABIs guide: https://developer.android.com/ndk/guides/abis
The section Automatic extraction of native code at install time states that:
When installing an application, the package manager service scans the APK, and looks for any shared libraries of the form:
lib/<primary-abi>/lib<name>.so
If none is found, and you have defined a secondary ABI, the service scans for shared libraries of the form:
lib/<secondary-abi>/lib<name>.so
Background: My app depends on an external library accessed through the JNI interface, but I was only provided with the e.g. libLibrary.so
file for the armeabi architecture. My app also uses another library which supports few different architectures like arm64-v8a etc. So, at runtime, I got an error like this because it couldn't find the libLibrary.so
:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[... /system/lib64]]] couldn't find "libLibrary.so"
Edit:
I was wondering if it is fine if I copied the libLibrary.so
from the armeabi folder into armeabi-v7a folder when the other libraries I depend on have .so files for armeabi-v7a but not armeabi. I have tested my app and it uses the library without problems when I set in gradle:
ndk.abiFilters "armeabi-v7a"
to only output the armeabi-v7a libraries in the apk file to make the app use them only.
So, I am wondering if it is just fine like that. I am using what is suggested here: https://medium.com/livefront/native-android-libraries-gone-bad-e7ff63f34bb