Search code examples
javaandroidandroid-studioandroid-ndkjava-native-interface

java.lang.UnsatisfiedLinkError: dlopen failed: .so library is 64-bit instead of 32-bit


I have a C library that I am hoping to wrap in JNI and call from my android project. The .so file is the following architecture: i386:x86-64. Whenever I add it to my project inside the src/main/jniLibs/arm64-v8a|armeabi-v7a|x86 folders, I get an error saying the .so file is 64-bit instead of 32-bit. I have tried cross-referencing this issue and noticed that people usually get the opposite issue, where the .so was 32-bit instead of 64-bit. I've tried combing through Android documentation to see where I messed up but can't seem to find a solution.


Solution

  • A 64-bit library should not be in src/main/jniLibs/armeabi-v7a folder. If your device supports arm64-v8a ABI, the app will be using the 64-bit library. If the device is not compatible, you cannot use this library.