react-native: [CRASH] Android 6.0.1 crashes with java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
I uploaded a RN0.60.4 release build to Google Play and they ran automated tests leading to a lot of crashes coming in with the following stack trace:
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName + 738(SoLoader.java:738)
at com.facebook.soloader.SoLoader.loadLibraryBySoName + 591(SoLoader.java:591)
at com.facebook.soloader.SoLoader.loadLibrary + 529(SoLoader.java:529)
at com.facebook.soloader.SoLoader.loadLibrary + 484(SoLoader.java:484)
at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit> + 20(HermesExecutor.java:20)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create + 27(HermesExecutorFactory.java:27)
at com.facebook.react.ReactInstanceManager$5.run + 949(ReactInstanceManager.java:949)
at java.lang.Thread.run + 818(Thread.java:818)
Affected OS is always 6.0.1. Interestingly Hermes is not even enabled in my build.gradle:
project.ext.react = [
entryFile: "index.android.js",
enableHermes: false, // clean and rebuild if changing
bundleInDebug: false,
bundleInRelease: true,
root: "../../",
]
...
def enableHermes = project.ext.react.get("enableHermes", false);
...
// Hermes config
if (enableHermes) {
def hermesPath = "../../node_modules/hermesvm/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
I looked into the app bundle and extracted the apk for the device type that is crashing. It contains the libjsc.so
file but not the libhermes.so
. Imho this is correct because my gradle is configured to not include it. The big question is why does it want to load it if it not enabled? What also surprised me is that I found libhermes-executor-release.so
and libhermes-executor-debug.so
in it too. I guess, they should be excluded?
I filed a report with the Hermes project here but they referred me to here.
React Native version:
System:
OS: macOS 10.14.6
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Memory: 88.63 MB / 32.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.16.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
Android SDK:
API Levels: 23, 26, 27, 28
Build Tools: 23.0.1, 25.0.0, 26.0.3, 27.0.3, 28.0.1, 28.0.2, 28.0.3
System Images: android-24 | Google APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5692245
Xcode: 10.3/10G8 - /usr/bin/xcodebuild
npmPackages:
react: ^16.8.6 => 16.8.6
react-native: ^0.60.4 => 0.60.4
npmGlobalPackages:
eslint-plugin-react-native: 3.5.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
Steps To Reproduce
- Upload an RN0.60.4 app bundle with crash reporting to Playstore
- check the crash reports
Describe what you expected to happen:
- The Google Play devices should not crash.
- Hermes library should not be loaded if disabled.
libhermes-executor-release.so
andlibhermes-executor-debug.so
should not get bundled
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 54
- Comments: 87 (2 by maintainers)
Commits related to this issue
- [android] Upgrade SoLoader to 0.8.2 As per https://github.com/facebook/react-native/issues/25923#issuecomment-625823694 — committed to expo/expo by sjchmiela 4 years ago
- [android] Upgrade SoLoader to 0.8.2 As per https://github.com/facebook/react-native/issues/25923#issuecomment-625823694 — committed to expo/expo by sjchmiela 4 years ago
- [android] Upgrade SoLoader to 0.8.2 As per https://github.com/facebook/react-native/issues/25923#issuecomment-625823694 — committed to expo/expo by sjchmiela 4 years ago
- [android] Upgrade SoLoader to 0.8.2 As per https://github.com/facebook/react-native/issues/25923#issuecomment-625823694 — committed to expo/expo by sjchmiela 4 years ago
- [android] Upgrade SoLoader to 0.8.2 As per https://github.com/facebook/react-native/issues/25923#issuecomment-625823694 — committed to expo/expo by sjchmiela 4 years ago
- tests: bump soloader dependency to fix ABI lib load issues soloader 0.8.0 has problems loading ABI-specific libraries in universal APKs, this workaround appears effective and allows the test APK to r... — committed to mikehardy/react-native-firebase by mikehardy 4 years ago
- Load jsc or hermes lib in static method (#30749) Summary: Many have reported about the misguiding error `Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so` even... — committed to facebook/react-native by iqqmuT 3 years ago
- Load jsc or hermes lib in static method (#30749) Summary: Many have reported about the misguiding error `Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so` even... — committed to facebook/react-native by iqqmuT 3 years ago
- React Native sync for revisions 17f6912...48b687f Summary: This sync includes the following changes: - **[48b687fc9](https://github.com/facebook/react/commit/48b687fc9 )**: [trusted types][www] Add e... — committed to facebook/react-native by sammy-SC a year ago
- React Native sync for revisions 17f6912...48b687f Summary: This sync includes the following changes: - **[48b687fc9](https://github.com/facebook/react/commit/48b687fc9 )**: [trusted types][www] Add e... — committed to OlimpiaZurek/react-native by sammy-SC a year ago
I was able to resolve it with a
./gradlew clean
in the/android
folder.Fixed with changing SoLoader version to 0.8.2 according to 0.62 react-native configuration. https://github.com/facebook/react-native/blob/master/ReactAndroid/gradle.properties
Having this issue too, when hermes disabled.
RN: 0.60.4
Device Brand: LGE Model: Nexus 5X Orientation: Portrait RAM free: 3.3 GB Disk free: 2.06 GB
Operating System Version: 6.0.1 Orientation: Portrait Rooted: Yes
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so at com.facebook.soloader.SoLoader.doLoadLibraryBySoName + 738(SoLoader.java:738) at com.facebook.soloader.SoLoader.loadLibraryBySoName + 591(SoLoader.java:591) at com.facebook.soloader.SoLoader.loadLibrary + 529(SoLoader.java:529) at com.facebook.soloader.SoLoader.loadLibrary + 484(SoLoader.java:484) at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit> + 20(HermesExecutor.java:20) at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create + 27(HermesExecutorFactory.java:27) at com.facebook.react.ReactInstanceManager$5.run + 949(ReactInstanceManager.java:949) at java.lang.Thread.run + 818(Thread.java:818)
"couldn’t find DSO to load: libhermes.so " React Native Version: 0.61.2 enableHermes: false Still facing this issue
I’m having occasional crashes like this in production with hermes disabled also on 0.60.4
This is because SOLoader is absent.
Ensure
implementation'com.facebook.soloader:soloader:0.9.0+'
is added under dependencies in android/app/build.gradlle
clean your build
cd android
./gradlew clean
Try bundling
./gradlew bundleRelease
Exit android folder
cd ../
Try running
npx react-native run-android --variant=release
received from crashlytics
I am also seeing this crash in production with RN 0.61.2, using android bundles with hermes disabled, on google nexus 5x
Still happening to production users randomly on 0.61.5 with Hermes disabled building as a bundle.
I have the same issue with the same version of android.
My Crashlytics report:
It worked for me in RN version 0.62.2 by adding to
android/app/build.gradle
:implementation 'com.facebook.soloader: soloader: 0.9.0+'
Same issue as well, RN 0.61.2, hermes disabled, seeing the same crashes reported for Nexus 5X 6.0.1 after uploading the app bundle to Play Store alpha track. Interestingly enough, Robo tests on Firebase Test lab are successful for Nexus 5 (physical device with android 6.0.1) and Nexus 5X (virtual device with android 6.0.1). Has anybody managed to reproduce this on any physical device?
Same issues on Android 6.0.1 Any solution?
I’ve added it somewhere in the middle of the large
android
block of theandroid/app/build.gradle
How is react 60 stable I don’t understand.
I have had crashes for Device Brand: LGE Model: Nexus 5X React Native Version: 0.60.3 Android Version: 6.0.1
I had created android app bundle( .aab file ) with hermes enabled. I have only debug and release variant. release variant has this problem. Issue is opened on Aug 3 and it’s been so many days, not a single working fix is available. Really frustrating.
In my case I needed to add hermes path for each android build type
Probably it should be mentioned in the doc, that it needs to be added for each build type.
same here, react-native 0.61.4
I’m having this same issue with the following conditions: -RN v0.63.4 -Hermes NOT enabled -> Using JSC -Latest SoLoader (0.10.1) -Using app bundle -Run gradle clean before bundleRelease -Issue only happens to certain devices on production (multiple Android versions and manufacturers)
After digging for a while I found this PR which mentions the “cause” of this issue when considering the previously mentioned conditions. The PR author does a really good job explaining how this problem occurs. In short, it’s not related to Hermes at all, but the real error is being discarded and Hermes is being loaded instead as a fallback, which in turn fails since it’s not enabled. That PR solves the “error swallowing” problem so the real error can be propagated when the app crashes. Please do merge that PR so we can figure out the real cause of this problem.
Any suggestion on how to reproduce for verification a given solution fixes this problem?
Current Verification Procedure:
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
I have tried enableHermes: false and various versions of resolution strategies for "com.facebook.soloader:soloader:0.9.0+ without success.
Why is it trying to load Hermes when enableHermes is set to false?
Same issue none of the above solutions worked for me still a crash on Nexus5 6.0.1
@JmStefanAndroid Add
configurations.all section
toandroid > build.gradle > allprojects
. This solved the issue for me. Plus, I runcd android ./gradlew clean
before each release.any solutions?
@jsaraiva Ofcourse I run
./gradlew clean bundleRelease
everytime for creating .aab file. I have now rolled out to Alpha with all the APKs along with universal apk for now.I’m using hermes and RN 0.64.2 and android flavors
this combination works for me
android > build.gradle > allprojects
then
cd android ./gradlew clean
and build again
this problem occurred while I upgrading from 0.59.4 to 0.61.0
in
android/app/build.gradle
I’ve addedand
and it works 😃 hope this solution is useful for someone
@jimmyceroneii After trying many, many solutions from around github/SO, the link you provided is what solved it for me.
https://stackoverflow.com/questions/61544046/android-java-lang-unsatisfiedlinkerror-couldnt-find-dso-to-load
EDIT: I also used soLoader version 0.9.0 instead of 0.8.2. Possibly due to using RN version 0.63.2
Upgraded to RN 0.62.2 and have the below crash in production
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: libhermes.so at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:789) at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:525) at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20) at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:997) at java.lang.Thread.run(Thread.java:818)
Brand: Xiaomi Model: Mi 9X Orientation: Portrait RAM free: 19.19 GB Disk free: 14.78 GB Operating System Version: 5.1 Orientation: Portrait Rooted: Yes Date: Jun 22, 2020, 10:44:00 PM
Have this in my android/build.gradle
maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") }
Any help on this would he really helpull.
Awesome. This fixed it for us 💪
But sadly this isn’t in React Native 0.62.2 as I discovered the issue after upgrading to it. The v0.63.0-rc.1 however already contains it , so I guess it will come soon.
As it is in the master here already I guess it is considered safe to upgrade the soloader to 0.8.2. Did anyone experience any issue because of it so far?
I added this in project gradle: it fixed my problem
allprojects { repositories { google() mavenLocal() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") } maven { url 'https://maven.google.com' } } }
We are getting this error everytime we want to do a
--variant=release
build after doing a debug one. Doing/gradlew clean
fixes it.This and all the “couldn’t find DSO to load” bugs have been fixed in React Native 0.71.
The issue on previous versions was a “too aggressive” clean-up logic in the
react.gradle
file. In 0.71 the clean-up logic has been rewritten to be more Android friendly and is now living inside the React Native Gradle Plugin.I’m closing this, please update to 0.71 and open a new issue if the “couldn’t find DSO to load” crash is still happening on 0.71+.
RN 0.62.2 here with hermes enabled. For me adding
configurations.all { resolutionStrategy { force "com.facebook.soloader:soloader:0.8.2" } }
to my top-level build.gradle and
implementation "com.facebook.soloader:soloader:0.8.2"
as well as
ndk { abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64" }
to my app-level build.gradle did the trick. I think that especially the latter made the difference as before both apk’s and aab’s showed an additional (fifth) lib folder
armeabi
which did not contain all lib files, in particular notlibhermes.so
.Important info if you use Hermes I updated from 61.5 to 62.2 and got a crash on android: couldn’t find DSO to load: libhermes-executor-debug.so
I fixed it by adding following string to android/app/build.gradle: implementation “org.webkit:android-jsc:+”
/android/gradlew clean
told meclean
was undefined for some reason. Manually deleting the /android/.gradle folder and rebuilding fixed it for me.I had the same issue and was because I forget to update the (app/android)/buld.gradle, as say the documentation, I checked the changes with https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.61.5 and updated those files, also check the other files, but the important part is
This might be related to https://github.com/facebook/SoLoader/issues/55
Same issue:
React Native: 0.61.5 Brand: LGE Model: Nexus 5X SO: 6.0.1
Fatal Exception: java.lang.UnsatisfiedLinkError couldn’t find DSO to load: libhermes.so
Android build.gradle
android/app/build.gradle
I’m seeing this crash in production with RN 0.61.2, using android bundles with hermes disabled, only on android 6 LGE devices.
Having the same issue, the project works fine on my local emulator but it gives the exact same error with @wsdt , any solutions yet?