I'm loading my native library like this at runtime
dlopen("mylib.so", RTLD_LAZY);
This works fine on recent version of android (e.g. marshmallow, nougat, etc.). However, on older versions (e.g. Jellybean), this fails with the following message in logcat
Failed to load mylib.so. Error: Cannot load library:
load_library[1093]: Library 'mylib.so' not found
I have ensured that mylib.so
is part of the apk. I have this as part of x86
and armeabi_v7a
architectures.
myapp.apk
- lib
- armeabi-v7a
mylib.so
- x86
mylib.so
As per readelf -d mylib.so | grep NEEDED
the dependencies are
0x00000001 (NEEDED) Shared library: [liblog.so]
0x00000001 (NEEDED) Shared library: [libm.so]
0x00000001 (NEEDED) Shared library: [libdl.so]
0x00000001 (NEEDED) Shared library: [libc.so]
I tried loading these dependencies through dlopen
prior to loading mylib.so
. Though loading of those dependencies succeed, loading mylib.so
always fails with the same error.
As mentioned before, I see this failure only on older versions of android.
How can I get this to work? Thanks in advance for any help.