react-native: [ANDROID] SoLoader error using App Bundle
🐛 Bug Report
Please help! There are some crashes happening in android using app bundle but I am not sure how to reproduce it. It happens on our app with daily crash of 200 users.
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484)
at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:30)
at com.facebook.react.bridge.NativeMap.(NativeMap.java:19)
at com.facebook.react.jscexecutor.JSCExecutorFactory.create(JSCExecutorFactory.java:25)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:944)
at java.lang.Thread.run(Thread.java:764)
The errors have multiple variations that occur on various android versions.
Fatal Exception: java.lang.UnsatisfiedLinkError
couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libfb.so caused by: couldn't find DSO to load: libgnustl_shared.so caused by: dlopen failed: "/data/data/com.traveloka.android/lib-0/libgnustl_shared.so" is 64-bit instead of 32-bit
Fatal Exception: java.lang.UnsatisfiedLinkError
couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libfb.so caused by: Dynamic section string-table not found
Fatal Exception: java.lang.UnsatisfiedLinkError
couldn't find DSO to load: libreactnativejni.so
To Reproduce
We have tried to reproduce it with many devices but we can only reproduce it in one condition.
- Install the release app
- Upgrade OS from 32bit to 64bit
- Open the app
If we reinstall the app afterwards, it works fine. Although, we are still unsure whether it is the only error case.
Expected Behavior
The app does not crash on any device.
Code Example
android {
...
defaultConfig {
...
ndk {
abiFilters "armeabi-v7a", "x86", "arm64-v8a"
}
}
}
Environment
React Native Environment Info:
System:
OS: macOS 10.14
CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 4.93 GB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.10.0 - ~/.nvm/versions/node/v8.10.0/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.8.0 - ~/.nvm/versions/node/v8.10.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
Build Tools: 23.0.1, 24.0.0, 24.0.3, 26.0.2, 26.0.3, 27.0.0, 27.0.3, 28.0.0, 28.0.2, 28.0.3
API Levels: 23, 24, 25, 26, 27, 28
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5264788
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.58.4 => 0.58.4
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 87
- Comments: 106 (17 by maintainers)
Try adding this in your app build.gradle:
Dublicate issue https://github.com/facebook/react-native/issues/28163
this command work for me
cd android/
Run./gradlew clean
That should probably fix this.
This fixed the issue for me in RN 0.62.2:
rm -rf $HOME/.gradle/caches/
just hit this on 0.59.10
Still having this issue
@RoJoHub many of us use deployment pipelines and don’t have access to directories. Also this is a hack not a fix and for any other team members on the project they need to be aware of this on each build.
I am getting:
unknown:NativeModuleInitError: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativeblob.so caused by: Error: Cannot load /data/app/com.***********-1/lib/arm/libreactnativeblob.so result: 0
with “react”: “16.13.1”, “react-native”: “0.63.2”,
We also hit this today on .59.10
Issue persists still for today. -React Native: 0.61.4 -React: 16.9.0
This is a huge problem. There’s no solution???
+1 This is happening on 0.59.10 with Android App Bundle. Happening on Vivo devices as seen on Play Console Dashboard in Android Vitals --> Crashes
This is not fixed for us. I would not close this issue.
v 0.62.2
rm -rf $HOME/.gradle/caches/
completely clean android install.Fails on an emulator installed with API 30 and API 28 with several errors all following the same format.
Strangely, it runs on API 29. This might be a clue. It seems the targeted emulator plays a role.
The issue referenced on the SoLoader repo perfectly describes the problem – but., since SoLoader, ships with react-native this seems like a ReactNative problem too.
Can you sync config files with RN0.58 Android template https://github.com/facebook/react-native/tree/0.58-stable/local-cli/templates/HelloWorld/android and try again?
EDIT:
And update to latest RN 0.58.6 please.
I had, I think, a similar problem. While upgrading from rn 0.55 to 0.60, the build was successful but launching the app I received the following errors:
I resolved it adding in the android/build.gradle
hope it will help someone 😃
“react-native”: “0.60.2”,
Same error
In my case ,this crash 100% happened when use google App Bundle.
I have got same issue: Fails on an emulator installed with API 30, but runs on API 29
For Vivo devices specifically, the come with their own app store, which we’ve discovered redistributes a lot of Play Store apps without permission. I’ve found our app on their store, and the package that they were distributing was just the base APK without platform-specific native library parts. I was able to reproduce the reported SoLoader crash by launching our app after installing it via the Vivo Appstore.
happens when I use ndk.abiFilters ‘armeabi-v7a’, ‘arm64-v8a’, ‘x86’, ‘x86_64’
java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: libreactnativejni.so caused by: couldn’t find DSO to load: libfb.so caused by: couldn’t find DSO to load: libc++_shared.so caused by: dlopen failed: “/data/data/com.bimp/lib-4/libc++_shared.so” is 32-bit instead of 64-bit FATAL EXCEPTION: create_react_context Process: com.bimp, PID: 15797 java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: libreactnativejni.so caused by: couldn’t find DSO to load: libfb.so caused by: couldn’t find DSO to load: libc++_shared.so caused by: dlopen failed: “/data/data/com.bimp/lib-4/libc++_shared.so” is 32-bit instead of 64-bit at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738) at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484) at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:31) at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:19) at com.facebook.react.jscexecutor.JSCExecutorFactory.create(JSCExecutorFactory.java:25) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:944) at java.lang.Thread.run(Thread.java:764)
This seems like the most promising solution to the problem:
https://github.com/facebook/SoLoader/issues/59#issuecomment-669161376
@tapz is correct. Just do what he suggested. Works like charm!!
@andrew-koster- this solution works for me
Having the same issue we can’t release the new update to our app as it crashes on every test we run in fire base - installs fine on simulator and other devices. I need to know what is causing this so we aren’t releasing an update to users that crashes on them:
“react-native”: “0.59.10”,
@minhh1 the so file that is causing issue is not listed in your fix above. Most of us are seeing this issue with
libreactnativejni.so
. is your suggestion enough to fix the issue being discussed here?Anyone tried this fix?
Did the same thing, manually upgraded to 0.60.0 from 0.59.1, missed this line, adding it fixed it! 😃
We are using
react-native:0.59.1
and getting this crash for following devices (using google app bundle)-Config in build.gradle-
In my case, the error does not appear on 0.61.5 anymore. Should I close this?
By default, APKs generated from the Android App Bundle have the native libraries uncompressed on devices on Android P+. Not only does that often reduce the download size but that also considerably reduce the size of the app on devices since the Android platform can directly read the native libraries from the APK instead of having to extract them to a separate location. There was a talk at last I/O on how to reduce the size of your app and how that impacts install numbers, and they detailed how this works if you’re interested in understanding this better.
So, now that you know why Google Play is doing this, you have the following options:
You can choose to revert to the original APK behaviour, and this can be done by adding the flag android.bundle.enableUncompressedNativeLibs=false in your gradle.properties file. This will effectively disable this optimization, leading to a bigger size of your app for all your users on M+.
You can ensure that the native library is loaded by the Android platform (e.g. using System.loadLibrary) or you if you’re reading the library directly yourself for some reason, read it from the APK directly as well.
If the native libraries are loaded by a third party library you’re depending on, consider filing a bug for them to address this issue so they follow the same logic as the platform.
Hey if you guys are you getting these errors reported on Firebase Crashlytics, then its very likely only due to a potential bug that was recently fixed on Firebase Crashlytics. See my comment in the this thread: https://github.com/facebook/react-native/issues/26075#issuecomment-553432192
We are seeing this show up in BugSnag as well after we went to App Bundles. Interestingly Google Play is reporting 0 crashes for apps installed from Play, but some for those “Installed from Anywhere”. The count from Bugsnag is a good bit higher than Play Console.
Top devices we see are vivo x9, Samsung Galaxy A70, Pixel, vivo S1, and a few others.
We are on RN 0.59.10, Gradle 3.3.0. Some relevant bits from build.gradle:
… ndk { abiFilters “armeabi-v7a”, “x86”, “arm64-v8a”, “x86_64” } }
Sill happening with 60.5 in Android 4
for me the issue was resolved when set
def enableProguardInReleaseBuilds = false
when its true, the app crashes on release with the so loader error. bare in mind that this increases the apk size
Hi, Even we are facing the same issue. It works fine with Standalone Apks (generated from bundle). But starts crashing with multi-apk install. Kindly help to resolve this.
Tried with RN Version 0.53.3, 0.58.6 and 0.59.0.