realm-js: UnsatisfiedLinkError when trying to load RealmReactModule
Hello There
We have an Android app that uses both the Android Realm SDK and the React Native Realm SDK.
Our app is in production and there are around 10 crashes ( <0.1% of users) that is related to java.lang.UnsatisfiedLinkError
Stacktrace
`Caused by java.lang.UnsatisfiedLinkError
java.lang.Runtime.load (Runtime.java:332) java.lang.System.load (System.java:1069) com.facebook.soloader.DirectorySoSource.loadLibraryFrom (DirectorySoSource.java:71) com.facebook.soloader.DirectorySoSource.loadLibrary (DirectorySoSource.java:42) com.facebook.soloader.SoLoader.loadLibraryBySoName (SoLoader.java:299) com.facebook.soloader.SoLoader.loadLibrary (SoLoader.java:247) io.realm.react.RealmReactModule. (RealmReactModule.java) io.realm.react.RealmReactPackage.createNativeModules (RealmReactPackage.java:15)
com.facebook.react.NativeModuleRegistryBuilder.processPackage (NativeModuleRegistryBuilder.java:107) com.facebook.react.ReactInstanceManager.processPackage (ReactInstanceManager.java:1021) com.facebook.react.ReactInstanceManager.createReactContext (ReactInstanceManager.java:959) com.facebook.react.ReactInstanceManager.access$600 (ReactInstanceManager.java:108) com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.doInBackground (ReactInstanceManager.java:225)
com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.doInBackground (ReactInstanceManager.java:203) android.os.AsyncTask$2.call (AsyncTask.java:295) java.util.concurrent.FutureTask.run (FutureTask.java:237) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1113) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:588) java.lang.Thread.run (Thread.java:818)`
Android Realm Plugin : ‘io.realm:realm-gradle-plugin:3.3.2’ React Realm Dependencies : “realm”: “^1.8.3”
it seems like Facebook’s DirectorySoSource.java file is trying to load in the RealmModule, but an UnsatisfiedLinkError has occurred. What are some possible reasons of why such an error would be thrown??
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 32 (15 by maintainers)
For those who wonder, I had the same issue (RN 0.58.6, Realm 2.25.0) and solved it with
And also:
def versionCodes = ["armeabi-v7a": 1, "x86": 2/*, "arm64-v8a": 3*/]include "armeabi-v7a", "x86"//, "arm64-v8a" // uncommented coz realm does not support 64 bit yetEdit: use this only if you’re not planning on releasing a 64 bits version of your app
Still got the error on latest version React Native (0.59.1), Realm 2.25.0. A crash app on some Android devices.
I solve the issue with, using the latest realm 2.22.0 enableProguardInReleaseBuilds = false
@kneth crashes on 2.12.0 and 2.13.0.
Edit: as @abury said, downgrading to 2.2.8 resolved the issue.
@martnst Yes, the explanation is
dlopen failed: "/data/data/com.rntestapp/lib-main/librealmreact.so" is 32-bit instead of 64-bit liband the fix is usingabiFilters. For 64 bit support, see #2221.@brayanL The solution above requires that all your libraries come in 32 bit versions. And that you only use the 32 bit versions (even if a 64 bit version exists).
The same crash occurred to my app after rebuilding it from scratch with React Native 0.58. Comparing the
android/app/build.gradlewith my old repo, I noticed that theabiFilterswas not present anymore. Thanks @tomas-paronai for you comment.I was able to reproduce it.
Steps to reproduce this:
$ react-native init RNTestApp$ cd RNTestApp$ yarn add realm$ react-native linkCrash Log
@AlexandreRozier Many places 🤔. Thanks for the update.