[CRASH] Android 6.0.1 crashes with java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so

See original GitHub issue

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

  1. Upload an RN0.60.4 app bundle with crash reporting to Playstore
  2. 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 and libhermes-executor-debug.so should not get bundled

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:54
  • Comments:86

github_iconTop GitHub Comments

183reactions
acouttscommented, Nov 5, 2019

I was able to resolve it with a ./gradlew clean in the /android folder.

103reactions
AlexandrDobrovolskiycommented, Mar 3, 2020

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

    configurations.all {
        resolutionStrategy {
            force "com.facebook.soloader:soloader:0.8.2"
        }
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

React-Native :java.lang.UnsatisfiedLinkError: couldn't find ...
They cannot be used side-by-side in one app, so all of the app code and dependency code needs to be using one or...
Read more >
Xiaomi devices crashes on uncompressed native library load
A developer reported that uploading an App Bundle to the Play Store results in a crash because the native library that our tool...
Read more >
Fixing React-Native android release build - wesionaryTEAM
Android release build crashes on launch but works fine in development mode. ... java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjsexecutor.so.
Read more >
App fixes flagged on Firebase Crashylitics - Mon 4th Jan, 2020
:java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so. I was seeing this error intermitently on some Android devices.
Read more >
How to Diagnose App Issues Using Crash Logs - Papertrail
First, let's walk through the four steps you need to follow to get the crash log after the app crashes. I'll use Android...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found