To have the library installed to /data/app-lib/com.example.testapp-1
it must follow the naming convention: libwhatever.so. You will use System.load("whatever")
in your static constructor to load it. You can rename the 3rd party file as you wish. Make sure that your new name is unique enough, because if Android device has same name in /system/lib
, then the system library will be loaded by Java.
loadLibrary fails with error findLibray returned null when using .so from other source
-
19-10-2022 - |
Question
I have a libother_team.so file from other team, I have added this .so directly in my project under path libs/armeabi-v7a/
When i try to load this library it fails with below error
java.lang.UnsatisfiedLinkError: Couldn't load other_team from loader
dalvik.system.PathClassLoader[dexPath=/data/app/com.example.testapp-1.apk,
libraryPath=/data/app-lib/com.example.testapp-1]: findLibrary returned null
I am blocked on this issue and any help regarding the same highly appreciated.
No correct solution
OTHER TIPS
Did you put the .so library into the correct path? The correct paths are:
- /libs/armeabi
- /libs/armeabi-v7a
- /libs/mips
- /libs/x86
based on the device architecture.
Also, be sure that the function you are trying to call is correctly defined into C code (and, obviously, that the Java native method correctly corresponds to the C function). Read here for more info.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow