question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] Couldn't find DSO to load crash in release build and hermes is enabled

See original GitHub issue

Description

Hermes is enabled with following packaging options in android.

packagingOptions { if (enableHermes) { // For Hermes, delete all the libjsc* files exclude "/libjsc*.so" if (taskName.contains(“Release”)) { // Reduce size by deleting the debugger/inspector exclude '/libhermes-inspector.so’ exclude ‘/libhermes-executor-debug.so’ } else { // Release libs take precedence and must be removed // to allow debugging exclude '/libhermes-executor-release.so’ } } else { // For JSC, delete all the libhermes* files exclude “**/libhermes*.so” } }

Getting this crash on release build.

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so caused by: couldn't find DSO to load: libreactnativejni.so caused by: ELF file truncated result: 0 result: 0
   at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:918)
   at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:740)
   at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:654)
   at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:634)
   at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:582)
   at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:25)
   at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29)
   at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1066)
   at java.lang.Thread.run(Thread.java:923)

Version

0.66.0

Output of npx react-native info

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: libhermes-executor-release.so caused by: couldn’t find DSO to load: libreactnativejni.so caused by: ELF file truncated result: 0 result: 0 at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:918) at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:740) at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:654) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:634) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:582) at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:25) at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1066) at java.lang.Thread.run(Thread.java:923)

Steps to reproduce

N/A

Snack, code example, screenshot, or link to a repository

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:34 (4 by maintainers)

github_iconTop GitHub Comments

30reactions
felix-lambertcommented, Aug 17, 2022

https://github.com/facebook/react-native/issues/25537#issuecomment-1182498993

Hello, for people who just migrated to RN 0.69.+ and are facing this issue too on Android, you should update android/app/build.gradle with the following code as Hermes now comes bundled with React Native accordingly to the official documentation :

dependencies {
    // ...

    if (enableHermes) {
+       implementation("com.facebook.react:hermes-engine:+") {
+           exclude group:'com.facebook.fbjni'
+       }
-       def hermesPath = "../../node_modules/hermes-engine/android/";
-       debugImplementation files(hermesPath + "hermes-debug.aar")
-       releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

This resolved the issue for me, hope it can help a few of you.

Best regards.

This worked for me

14reactions
1natsu172commented, Feb 22, 2022

@cortinico

This is also happening in my Android environment. I’m working on bumping from 0.63.2 to 0.67.1, and the application in the release build crashes immediately before the splash screen.

Multiple logs of couldn't find DSO to load can be seen in the adb log output. An excerpt is below.

Logs 02-22 18:00:04.412 9890 9890 E AndroidRuntime: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so 02-22 21:42:28.406 3548 3548 E SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found result: 0 02-22 21:48:22.995 4603 4603 E SoLoader: couldn't find DSO to load: libjscexecutor.so 02-22 21:48:23.033 4603 4603 E SoLoader: couldn't find DSO to load: libhermes-inspector.so caused by: dlopen failed: cannot locate symbol "_ZTIN8facebook6hermes8debugger13EventObserverE" referenced by "/data/data/jp.exampleapp.canary/lib-main/libhermes-inspector.so"... result: 0 02-22 21:48:23.034 4603 4603 W System.err: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-inspector.so caused by: dlopen failed: cannot locate symbol "_ZTIN8facebook6hermes8debugger13EventObserverE" referenced by "/data/data/jp.exampleapp.canary/lib-main/libhermes-inspector.so"... result: 0 02-22 21:48:23.034 4603 4603 E SoLoader: couldn't find DSO to load: libhermes-executor-common-debug.so caused by: couldn't find DSO to load: libhermes-inspector.so caused by: dlopen failed: cannot locate symbol "_ZTIN8facebook6hermes8debugger13EventObserverE" referenced by "/data/data/jp.exampleapp.canary/lib-main/libhermes-inspector.so"... result: 0 result: 0 02-22 21:48:23.034 4603 4603 W System.err: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-common-debug.so caused by: couldn't find DSO to load: libhermes-inspector.so caused by: dlopen failed: cannot locate symbol "_ZTIN8facebook6hermes8debugger13EventObserverE" referenced by "/data/data/jp.exampleapp.canary/lib-main/libhermes-inspector.so"... result: 0 result: 0 02-22 21:48:23.034 4603 4603 W System.err: Caused by: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-inspector.so caused by: dlopen failed: cannot locate symbol "_ZTIN8facebook6hermes8debugger13EventObserverE" referenced by "/data/data/jp.exampleapp.canary/lib-main/libhermes-inspector.so"... result: 0 02-22 21:48:23.035 4603 4603 E SoLoader: couldn't find DSO to load: libhermes-executor-debug.so caused by: couldn't find DSO to load: libhermes-executor-common-debug.so caused by: couldn't find DSO to load: libhermes-inspector.so caused by: dlopen failed: cannot locate symbol "_ZTIN8facebook6hermes8debugger13EventObserverE" referenced by "/data/data/jp.exampleapp.canary/lib-main/libhermes-inspector.so"... result: 0 result: 0 result: 0 02-22 21:48:23.035 4603 4603 E SoLoader: couldn't find DSO to load: libhermes-executor-release.so 02-22 21:48:23.036 4603 4603 W System.err: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so 02-22 21:48:23.036 4603 4603 E AndroidRuntime: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so
npx react-native info

System: OS: macOS 12.2.1 CPU: (8) arm64 Apple M1 Pro Memory: 99.73 MB / 16.00 GB Shell: 3.3.1 - /opt/homebrew/bin/fish Binaries: Node: 14.18.2 - ~/.asdf/installs/nodejs/14.18.2/bin/node Yarn: 1.22.17 - /opt/homebrew/bin/yarn npm: 6.14.15 - ~/.asdf/plugins/nodejs/shims/npm Watchman: 2022.01.24.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.2 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 Android SDK: API Levels: 29, 30, 32 Build Tools: 28.0.3, 29.0.2, 30.0.2, 32.0.0 System Images: android-31 | Google APIs ARM 64 v8a, android-32 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7935034 Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild Languages: Java: 1.8.0_312 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.67.1 => 0.67.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found


#33065, #33079 also looks like a very similar Issue. However, each seems to have a different version of RN. Is there a widespread impact on the release build?

※This problem did not occur in the debug build

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-Native :java.lang.UnsatisfiedLinkError: couldn't find ...
In case you're facing this error while updating to React Native version 0.62.2 : Add the following to your android/app/build.gradle file:
Read more >
Fixing React-Native android release build - wesionaryTEAM
Android release build crashes on launch but works fine in development mode. ... UnsatisfiedLinkError: couldn't find DSO to load: libjsexecutor.so.
Read more >
App fixes flagged on Firebase Crashylitics - Mon 4th Jan, 2020
UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so. I was seeing this error intermitently on some Android devices. I had previously enabled ...
Read more >
Using Hermes - React Native
Edit your android/app/gradle.properties file and make sure hermesEnabled is true: # Use this property to enable or disable the Hermes JS engine.
Read more >
Getting “java.lang.UnsatisfiedLinkError: couldn't find DSO to ...
Android – Getting “java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so” error ... I let Hermes disabled in my app build.gradle file:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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