I uploaded a 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
}
Setup:
System:
OS: macOS 10.14.6
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Memory: 82.07 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
Thanks for the more detailed report! A few other people have reported similar issues in https://github.com/facebook/react-native/issues/25601 and running ./gradlew clean has fixed it. Can you try that?
Our build pipeline does fresh checkouts removing all gradle caches programmatically and running gradle in a non-daemon mode.
rm -rf node_modules && rm -rf $TMPDIR/react-*
rm -rf $HOME/.gradle/caches
npm i
echo "Build Android"
bundle exec fastlane android build flags:--no-daemon --env=live
Shouldn't that be sufficient and not require us to run a ./gradlew clean ?
I don't really know a lot about fastlane and how it interacts with gradle, so I'm not knowledgeable enough to answer that. Perhaps someone else is, but you might be better off opening a react-native issue, since this seems more likely to be an issue with the react native build files than the hermes build files, and there are more people paying attention to these kinds of issues over there.
That said, the error you're seeing implies that the apk doesn't have a libhermes.so or a libjsc.so in it. Can you look at your apk, and see if either is there? If you're building without hermes, then libjsc.so should be in the apk, and if it's not, then that's the problem you'll need to understand and fix.
Thanks @mhorowitz for the hint. I did look into the app bundle and extracted the apk for the device type. It contains the libjsc.so file but not the libhermes.so. Which imho 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. Shouldn't they be excluded too? If you think it will make sense to bring this up in the react-native project, I will do so and link the issue here.

the relevant bit of code is here: https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java#L288-L296 React Native tries to load JSC, and if it's not present, it tries to load Hermes. If the latter fails, you get the exception you're seeing.
Since you're building for JSC, the latter error is expected, but the first error is not. From your screen shot, libjscexecutor.so seems to be present, but the code is swallowing the error loading JSC, which is what would tell us what's wrong. I've asked someone here to improve the error reporting. In the interim, you could hack this code to comment out the try/catch. This will break enableHermes in the gradle files, but it should illuminate the problem.
One hypothesis is that the failing devices are not arm32, and the libraries for that platform are different.
I it makes sense to open an RN issue. I'm not sure what the problem is, but I suspect the fix will need to be in the react-native repo.
You're right that those hermes .so files should be excluded, but that's a separate problem.
Is this related to this issue I am having with Hermes not working with (.abb) bundle releases?
Not sure if it's relevant to you guys, but I ran into a somewhat similar issue where jsc wasn't being loaded. This comment might help: https://github.com/facebook/react-native/issues/25986#issuecomment-520424504
I am using firebase to track the crashes and a few of my users with following Android version are having crashes:
Android 4.2.2
Android 4.3
Android 4.3.1
Android 4.4.2
Android 5.1
Fatal Exception: java.lang.UnsatisfiedLinkError - couldn't find DSO to load: libhermes.so
I am using RN 0.60.5 and split APKs.
+1
I'm seeing this crash in production with RN 0.61.2, using android bundles with hermes disabled.
Something wrong with SoLoader.loadLibrary("jscexecutor");
private JavaScriptExecutorFactory getDefaultJSExecutorFactory(String appName, String deviceName) {
try {
// If JSC is included, use it as normal
SoLoader.loadLibrary("jscexecutor"); // something wrong with here
return new JSCExecutorFactory(appName, deviceName);
} catch(UnsatisfiedLinkError jscE) {
jscE.printStackTrace(); // something wrong with here
// Otherwise use Hermes
return new HermesExecutorFactory();
}
}
The crash is here https://github.com/facebook/react-native/issues/25923#issuecomment-554295179
I'm still trying to find the solution. -!!!
@woshi82 Did you look into my comment into the other issue? https://github.com/facebook/react-native/issues/25986#issuecomment-520424504
facebook/react-native#25986 (comment)
@Zloka
YES锛宐ut not work.
My project has used Jsc, and disable Hermes.
It OK in android 6.* 7.*
It has crashed in android 5.0
Hi guys, I am receiving crashes and mostly from a user with android 6.0.1 and also, 7.1.1, '5.1.1'
Also, l'm wondering if we can recreate this issue on debug mode, can we !!
Any news on this???. Crashes all over android 6.0 devices
Would be very nice to have a fix on that, I resorted to using APK instead of AAB, but now the app is 3x bigger.
I did a review of the issue using crashlytics. The problem seems to be on the emulator/dev devices. In my case, 100% of the events were tagged as a Nexus device using Andriod 6.0 (At this time, I was using the simulator).
Hope it helps
As observed above, this error will happen when JSC can't load, and Hermes is not enabled. I have landed a change in https://github.com/facebook/react-native/commit/65d3167a802b2ca04d4f05ff972c2d51765f1e0d to clarify the warning. I'll try to get this picked into RN 0.62, but for now I'm going to close this issue, in favor of reports based on the new code which will help us diagnose this better.
has same issue on android 4 when hermes is disabled
@Desintegrator minSdkVersion for react-native is 21 now, I doubt Android 4.x issues will see any attention at all.
@mikehardy is there any official announcement about that? RN repo says it supports sdk 16 or newer.
@Desintegrator See https://github.com/facebook/react-native/commit/a17ff44adcf003dd4e4ef2301e1f80b77913f712 - it's happening in 0.64
There is a PR related to the error java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so: facebook/react-native#30749
The PR does not fix the real issue, but it fixes the error handling. Like many have said, the error about libhermes.so is misguiding because the real issue must be something to do with JSC loading when Hermes is disabled.
Most helpful comment
I am using firebase to track the crashes and a few of my users with following Android version are having crashes:
Android 4.2.2
Android 4.3
Android 4.3.1
Android 4.4.2
Android 5.1
Fatal Exception: java.lang.UnsatisfiedLinkError - couldn't find DSO to load: libhermes.soI am using RN 0.60.5 and split APKs.