I used flutter to create android app which uses jniLibs, I don’t use ffi, instead I am directly call .so lib with Process.run from nativeLibDirectory. It works fine in debug mode, in release mode I am getting Process exception that ****.so file not found. When I unpack released apk file I see that all libs are presents in “libs” folder, but after installation of apk I see that they are missing in nativeLibDirectory of app(in debug mode it presents=successfully extracted).
As I know, the reason for such behavior is the introduction with android 6 ability for native libraries to be stored uncompressed within the .apk along with the ability to load those native libraries from the .apk without requiring a separate filesystem copy of the native libraries.
How could I force android to extract libs in to nativeLibDirectory, not to store them in base.apk only? As I told, it works perfectly in debug mode, not in release mode.
I am already added to AndroidManifest.xml "android:extractNativeLibs="true""
but it hasn’t changed anything.
I am also tried to add in build.gradle those options (and combinations) but it is still not working as mentioned:
ndk {
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
}
===
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
===
sourceSets {
main {
jniLibs.srcDirs = ['libsrc/main/jniLibs']
}
}
How could I force android to extract libs in to nativeLibDirectory, not to store them in base.apk only? As I told, it works perfectly in debug mode, not in release mode.