UnsatisfiedLinkError: dlopen failed "librealm-jni.so" is 32-bit instead of 64-bit
Expected Results
I want to use 32-bit so librealm-jni.so in 64-bit device without UnsatisfiedLinkError with com.android.tools.build:gradle:2.1.0-alpha3
I manually exclude lib/arm64-v8a/librealm-jni.so to prevent UnsatisfiedLinkError in 64-bit arch device.
(This was workaround for UnsatisfiedLinkError when some native libraries is not build for 64-bit)
Actual Results
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/kr.co.vcnc.android.couple/app_lib/librealm-jni.so" is 32-bit instead of 64-bit
at java.lang.Runtime.load(Runtime.java:331)
at java.lang.System.load(System.java:981)
at io.realm.internal.android.ReLinker.loadLibrary(ReLinker.java:75)
at io.realm.internal.RealmCore.loadLibrary(RealmCore.java:89)
at io.realm.RealmConfiguration$Builder.<init>(RealmConfiguration.java:338)
at kr.co.vcnc.android.couple.core.CoupleApplication.getDefaultRealmConfiguration(CoupleApplication.java:306)
at kr.co.vcnc.android.couple.core.CoupleApplication.onCreate(CoupleApplication.java:147)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4699)
at android.app.ActivityThread.access$1500(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1409)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5421)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)
Steps & Code to Reproduce
com.android.tools.build:gradle:2.1.0-alpha3- BuildTools 23.0.3
- Gradle 2.10
- Exclude 64bit librealm-jni.so
- Run on 64-bit device
Version of Realm and tooling
Realm version(s): 0.88.2
Android Studio version: 2.1 Preview 3. (but i usually build using terminal)
Which Android version and device: The 64-bit device that i have is LG-F600S (OS 5.1.1)
Do you have other 3rd party libs which has 64bit so file?
Yes,
I'm using RenderScript and build tools add librsjni.so and libRSSupport.so in arm64-v8a folder.
Are these file a cause?
Yes, the system will try to load 64bit so first, and 64bit so cannot be working with other 32 bit so at the same time. I think you need to exclude them as well ... Or get 64bit Realm so back if all of your native libs have 64 bit so.
After i excluded librsjni.so, libRSSupport.so in arm64-v8a, it works well!
Thanks you so much @beeender !
You are welcome!
Fix with Upgrade Gradle Version to 6.1.1