Use 32-bit jni libraries on 64-bit android

I’ve tried running an application using a native library on the Nexus 9.

The application exits with an error message:

  • How to set my Activity as main activity in android?
  • Best practice: Extending or overriding an Android library project class
  • Was PreferenceFragment intentionally excluded from the compatibility package?
  • Android OpenGL ES Transparent Background
  • how to refresh custom listview using baseadapter in android
  • How to disable onItemSelectedListener to be invoked when setting selected item by code
  • java.lang.UnsatisfiedLinkError: dlopen failed: "" is 32-bit instead of 64-bit

    Is there any known workaround for this problem (except, of course, recompiling the library and making the apk bigger)?

    Related posts:

    Cordova app that doesn't use push notifications: “Missing push notification entit...
    Scroll Webview in Viewpager
    how can we use startActivityforResult() for Email intent?
    No static method zzUr() in Firebase when I try to use Analytics with Notifications
    How to get an Android “bound” service to survive a configuration restart
    Add touch events to VrPanoramaView class of google cardboard SDK for android
  • Loading Drawable Image Resource in Fresco's SimpleDraweeView
  • retrofit convertor factory can not access GsonConverterFactory
  • Android create shortcuts on the home screen
  • What do I do about: this requires android.permission.INTERACT_ACROSS_USERS_FULL
  • Android: How to implement viewpager and views in single xml file
  • How to stream Android Phone Screen to the PC
  • 5 Solutions collect form web for “Use 32-bit jni libraries on 64-bit android”

    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.

    the point is to convert the run environment to 32 bit

    1. add the follow content into ‘build.gradle’ ‘defaultConfig’:
      ndk {abiFilters “armeabi”, “armeabi-v7a”, “x86”, “mips” }
    2. add android.useDeprecatedNdk=true into
    3. add new folder named armeabi under the libs, then copy a 32bit “.so” file
      into the new folder

    Try this in you


    Nop, you need to get the native library to be compatible with 64-bit for it to work.

    See official documentation: JNI Tips: 64-bit Considerations

    I encountered the same issue, when I did the update from Android Studio 2.1 to 2.2.3 (with ndk v.13.1), and no tips found in google really helped me (like using abiFilters, exclude ‘lib/x86_64/lib….so’, LOCAL_MULTILIB := 32, or TARGET_PREFER_32_BIT := true, …).

    Finally, I was able to make it worked again with the latest AS v2.2.3 (without changing anything in or in build.gradle), just by using my previous ndk compiler, i.e. android-ndk-r10e

    I built the library manually with ndk-build for “armeabi-v7a” and “x86” only, and it worked like a charm on Android with arm64.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.