Use 32-bit jni libraries on 64-bit android
the point is to convert the run environment to 32 bit
add the follow content in build.gradle
defaultConfig: { ... ndk { abiFilters "armeabi", "armeabi-v7a", "x86", "mips" } }
add
android.useDeprecatedNdk=true
into gradle.properties- add new folder named armeabi under the libs, then copy a 32bit
.so
file into the new folder
This work for me:
ndk {
abiFilters 'armeabi-v7a', 'x86'
}
Found an explanation: 64-bit Android can use 32-bit native libraries as a fallback, only if System.loadlLibrary() can't find anything better in the default search path. You get an UnsatisfiedLinkError if you force the system to load the 32-bit library using System.load() with the full library path. So the first workaround is using System.loadLibrary() instead of System.load().
An additional thing that has to be taken into account is that libraries cannot be mixed: the fallback behaviour only applies for the first library your application loads. If the first one is 64-bit, no 32-bit libraries can be loaded by the same application, and vice versa.