Use 32-bit jni libraries on 64-bit android

Solution 1:

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.

Solution 2:

the point is to convert the run environment to 32 bit

  1. add the follow content in build.gradle

    defaultConfig: { ... ndk { abiFilters "armeabi", "armeabi-v7a", "x86", "mips" } }

  2. add android.useDeprecatedNdk=true into gradle.properties

  3. add new folder named armeabi under the libs, then copy a 32bit .so file into the new folder

Solution 3:

This work for me:

 ndk {
        abiFilters 'armeabi-v7a', 'x86'
    }

Solution 4:

https://source.android.com/source/64-bit-builds.html

Try this in you Android.mk

LOCAL_MULTILIB := 32