It seems to me that gradle Android plugin does not include versioned .so libraries into .aar archive.
My case:
I need to load some library in Android application that requires another library: libz.so.1
I do have libz.so
and libz.so.1
in my native libraries directory.
After running gradle there is only libz.so
library in created .aar archive.
It results in java.lang.UnsatisfiedLinkError: dlopen failed: library "libz.so.1" not found
exception when I try to run my application.
It looks like my otherlibrary
tries to load only that specific version of libz.
readelf -d otherlibrary.so
also tells me that it wants specific library:
0x00000001 (NEEDED) Shared library: [libz.so.1]
Both libraries that I want to load are third party libraries. It looks like I need to find a way for one of the following:
- pack
libz.so.1
into .aar archive, sootherlibrary.so
could easily link with it - load
libz.so
and somehow makeotherlibrary.so
to link with it
but I'm running out of ideas, how to do it.
Part of build.gradle that builds .aar archive:
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
libs
directory contains both libz.so
and libs.so.1
libraries. Only libz.so
is assembled into .aar file.
This page: https://developer.android.com/studio/projects/android-library#aar-contents
suggests me that only /jni/abi_name/name.so
pattern is supported.
Looking forward for some help.