Reputation: 1807
I am loading an ndk module dependent on libgnustl_shared.so
I am calling both mylib.so
and gnustl_shared
using:
System.load("/data/data/package/files/libgnustl_shared.so");
System.load("/data/data/package/files/mylib.so");
from an external package, due to product requirements (and not from jniLibs - loadlibrary)
It works like a charm on every device however on lg g4 armv8 liba.so
can't find libgnustl_shared
. It's works fine on other armv8 phones.
How can it happen ? Does any one know how to solve this issue in a generic\spesific way ?
Upvotes: 0
Views: 467
Reputation: 1807
found the answer thanks to Alex Cohn
LG G4 devices have libstlport.so in the system/lib64 folder. this lib is another c++ helper run-time. described in : http://developer.android.com/ndk/guides/cpp-support.html
when calling system.load() to libgnustl_shared.so, the device called libstlport from lib64 instead of the path specified. since the jni module isn't built on libstlport and it has different code inside mylib.so couldn't handle the situation
solution:
compile the jni libs with gnustl_static
call both libgnustl_shared and the compiled library (mylib.so) from the scope of the main application, and not from the scope of an external library. i.e.:
System.loadLibrary("gnustl_shared"); System.loadLibrary("your_native_library");
Upvotes: 1