Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

couldn't find DSO to load: libhermes.so (hermes disabled) #29528

Closed
0hio-creator opened this issue Jul 30, 2020 · 23 comments
Closed

couldn't find DSO to load: libhermes.so (hermes disabled) #29528

0hio-creator opened this issue Jul 30, 2020 · 23 comments
Labels
Needs: Attention Issues where the author has responded to feedback. Newer Patch Available Resolution: Locked This issue was locked by the bot. Tech: Hermes Hermes Engine: https://hermesengine.dev/

Comments

@0hio-creator
Copy link

Description

I'm getting error reports for couldn't find DSO to load: libhermes.so

I have hermes disabled but still seems to be tripping up my build.

com.facebook.soloader.SoLoader.doLoadLibraryBySoName (SoLoader.java:738)
com.facebook.soloader.SoLoader.loadLibraryBySoName (SoLoader.java:591)
com.facebook.soloader.SoLoader.loadLibrary (SoLoader.java:529)
com.facebook.soloader.SoLoader.loadLibrary (SoLoader.java:484)
com.facebook.hermes.reactexecutor.HermesExecutor. (HermesExecutor.java:20)
com.facebook.hermes.reactexecutor.HermesExecutorFactory.create (HermesExecutorFactory.java:27)
com.facebook.react.ReactInstanceManager$5.run (ReactInstanceManager.java:952)
java.lang.Thread.run (Thread.java:818)

React Native version:

System:
OS: macOS 10.15.6
CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
Memory: 207.63 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 13.6.0 - /usr/local/bin/node
npm: 6.13.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK:
API Levels: 28, 29
Build Tools: 28.0.3, 29.0.2
System Images: android-18 | Google APIs Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-21 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6392135
Xcode: 11.6/11E708 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5

Steps To Reproduce

Been unable to reproduce but have the error on a range of device and android os versions from 6 to 10.

Expected Results

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

Seen other report this issue when are trying to use Hermes and tried to make their fixes but was not resolved it for when i am not using hermes

android/app/build.gradle

project.ext.react = [
    entryFile: "index.js",
    enableHermes: false,  // clean and rebuild if changing
]

def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false);

dependencies {
    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

android/build.gradle

allprojects {
    repositories {
        google()
        jcenter()
        mavenLocal()
        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://jitpack.io' }
    }
}

Any help on this would be greatly appreciated.

@luatnd
Copy link

luatnd commented Jul 30, 2020

Mee too, same react-native version.
Crashed at libhermes.so and libhui.so on some devices.

@zhubinsheng
Copy link

新建一个全新的rn项目
将全新的rn项目中的android中的 android\gradle\wrapper\gradle-wrapper.properties里面的东西复制到自建android项目中

将全新的rn项目中的android中的android\settings.gradle里面的东西合并到自建android项目中

将全新的rn项目中的android中的里面两个build.gradle文件里面的东西分别合并到自建android项目中

将全新的rn项目中的android中的里面gradle.properties文件里面的东西分别合并到自建android项目中

这样可以运行,但是未从根本上解决问题

@chrisglein chrisglein added Tech: Hermes Hermes Engine: https://hermesengine.dev/ Newer Patch Available and removed Needs: Triage 🔍 labels Aug 5, 2020
@github-actions
Copy link

github-actions bot commented Aug 5, 2020

⚠️ Using Old Version
ℹ️ It looks like you are using an older version of React Native. Please upgrade to the latest version, and verify if the issue persists. If it does not, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the current release.

@zhubinsheng
Copy link

⚠️ Using Old Version
ℹ️ It looks like you are using an older version of React Native. Please upgrade to the latest version, and verify if the issue persists. If it does not, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the current release.

the last version also didn't help,i had tried 0.63 and 0.61 and 0.59.

@zhubinsheng
Copy link

⚠️ Using Old Version
ℹ️ It looks like you are using an older version of React Native. Please upgrade to the latest version, and verify if the issue persists. If it does not, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the current release.

But if copy the configuration of the auto generated Android project, it works and help me

@vineetshetty
Copy link

Can confirm that the exact same issue exists in 0.63.2 as well

@luatnd
Copy link

luatnd commented Sep 11, 2020

⚠️ Using Old Version
ℹ️ It looks like you are using an older version of React Native. Please upgrade to the latest version, and verify if the issue persists. If it does not, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the current release.

But if copy the configuration of the auto generated Android project, it works and help me

@zhubinsheng Your issue was really gone?

@zhubinsheng
Copy link

warning Using Old Version
information_source It looks like you are using an older version of React Native. Please upgrade to the latest version, and verify if the issue persists. If it does not, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the current release.

But if copy the configuration of the auto generated Android project, it works and help me

@zhubinsheng Your issue was really gone?

yes i had run successfully and can display the react native interface from the native
How do you add it now?

@luatnd
Copy link

luatnd commented Sep 17, 2020

I upgraded from react-native several times from 0.59 > 0.60 > 0.61.5 > 0.63.2
I've modified too much on the native side so migrating on the native side is a painful work for me.


I follow the commit to choose which should I upgrade here:
https://react-native-community.github.io/upgrade-helper/?from=0.61.5&to=0.63.2

@luklew
Copy link

luklew commented Oct 27, 2020

I'm having same issues , using RN 0.63.3:

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so

I have hermes set to false as shown below... Any ideas?

project.ext.react = [
enableHermes: false
]
def enableHermes = project.ext.react.get("enableHermes", false);

@zhubinsheng
Copy link

Create a new RN project

In the new RN project, the Android / gradle / wrapper / gradle- wrapper.properties Copy the contents into the self built Android project

The Android in the new RN project\ settings.gradle The contents are merged into the self built Android project

In the brand-new RN project, two of them are in Android build.gradle The contents in the file are merged into the self built Android project

In the new RN project, the Android gradle.properties The contents in the file are merged into the self built Android project

This works and help me

@0hio-creator
Copy link
Author

@zhubinsheng
Hey thanks for this method.

Just a couple of questions.

  1. When Create a new RN Project is that the same RN version as your existing project? Or does it need to be the latest RN version?
  2. You copy the following files from the new RN project to the existing project?

From the root of an RN project

android/gradle/wrapper/gradle-wrapper.properties
android/settings.gradle
android/build.gradle
android/app/build.gradle

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Nov 1, 2020
@zhubinsheng
Copy link

@zhubinsheng
Hey thanks for this method.

Just a couple of questions.

  1. When Create a new RN Project is that the same RN version as your existing project? Or does it need to be the latest RN version?
  2. You copy the following files from the new RN project to the existing project?

From the root of an RN project

android/gradle/wrapper/gradle-wrapper.properties
android/settings.gradle
android/build.gradle
android/app/build.gradle

Try to use a newer version, preferably with the same version number; then copy some configuration of the new RN project into your own configuration file

@0hio-creator
Copy link
Author

I have implemented and gone through 2 releases without seeing the issue.
I'm going to list the changes between a new RN project and mine if that helps anyone

I also added to android/app/build.gradle a soloader library update

dependencies {
    implementation 'com.facebook.soloader:soloader:0.9.0+'
...

In android/app/build.gradle deleted dexOptions & multiDexEnabled

android {
  -dexOptions {
    -javaMaxHeapSize "3g"
  -}

   defaultConfig {
   ...
  -multiDexEnabled true

  }

In android/build.gradle moved google() & jcenter()

allprojects {
    repositories {
        - google()
        - jcenter()
        mavenLocal()
        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")
        } 
        + google()
        + jcenter()
        maven { url 'https://jitpack.io' }
    }
}

android/gradle/wrapper/gradle-wrapper.properties
updated gradlew

-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

android/settings.gradle moved include:'app'

 rootProject.name = 'App'
-include ':app'
 apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
+include ':app'

Thanks @zhubinsheng for your help, much appreciated!

@Michaelvons
Copy link

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

@YCMitch
Copy link

YCMitch commented Feb 16, 2021

Thank you SO much @Michaelvons, that works perfectly!

@troZee
Copy link
Contributor

troZee commented Apr 13, 2021

In my case I needed to add hermes path for each android build type

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
        qaImplementation files(hermesPath + "hermes-release.aar")
        stageImplementation files(hermesPath + "hermes-release.aar")
        prodImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

@ak-paca
Copy link

ak-paca commented Apr 13, 2021

In my case I needed to add hermes path for each android flavour

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
        qaImplementation files(hermesPath + "hermes-release.aar")
        stageImplementation files(hermesPath + "hermes-release.aar")
        prodImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

Thanks, man.
That's solved my issue (I had to pass releaseStagingImplementation files(hermesPath + "hermes-release.aar")

@sonivaibhav27
Copy link

In my case I needed to add hermes path for each android flavour

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
        qaImplementation files(hermesPath + "hermes-release.aar")
        stageImplementation files(hermesPath + "hermes-release.aar")
        prodImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

Thanks, man.
That's solved my issue (I had to pass releaseStagingImplementation files(hermesPath + "hermes-release.aar")

I m getting error Could not find method releaseStagingImplementation() for arguments [file collection] , please tell me how did you tackle this?

@troZee
Copy link
Contributor

troZee commented Jun 25, 2021

In my case I needed to add hermes path for each android flavour

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
        qaImplementation files(hermesPath + "hermes-release.aar")
        stageImplementation files(hermesPath + "hermes-release.aar")
        prodImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

Thanks, man.
That's solved my issue (I had to pass releaseStagingImplementation files(hermesPath + "hermes-release.aar")

I m getting error Could not find method releaseStagingImplementation() for arguments [file collection] , please tell me how did you tackle this?

bc you have to adjust it to your buildTypes. That was just only an example.

@sonivaibhav27
Copy link

In my case I needed to add hermes path for each android flavour

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
        qaImplementation files(hermesPath + "hermes-release.aar")
        stageImplementation files(hermesPath + "hermes-release.aar")
        prodImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

Thanks, man.
That's solved my issue (I had to pass releaseStagingImplementation files(hermesPath + "hermes-release.aar")

I m getting error Could not find method releaseStagingImplementation() for arguments [file collection] , please tell me how did you tackle this?

bc you have to adjust it to your buildTypes. That was just only an example.

Hey can you provide your changes to buildTypes ,Thanks for responding ?

@0hio-creator
Copy link
Author

I actually only had limited success with the last solution.
After a few bug free releases came up with the same issue.

Since then I have switched to releasing apks.

Following these comments:
facebook/SoLoader#55 (comment)
facebook/SoLoader#55 (comment)

From what I understand it's an issue with ABI's generating apk's differently via build and the play store.

For performance reasons I also switched to hermes.
I was worried about bundle size but found actually that apk's with hermes were actually smaller than the ABI.

jscFlavor 15.28 mb
Hermes 15.59 mb
Hermes + apk 13.24 mb

I enabled the following in android/app/build.gradle to get the above bundle size

def enableSeparateBuildPerCPUArchitecture = true

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = true

I haven't seen this crash this making the change which was a couple of months ago now

@yzhangdegit
Copy link

In my case I needed to add hermes path for each android build type

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
        qaImplementation files(hermesPath + "hermes-release.aar")
        stageImplementation files(hermesPath + "hermes-release.aar")
        prodImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

thanks~ That's solved my issue.

noumantahir added a commit to ecency/ecency-mobile that referenced this issue Aug 16, 2021
it was potentially causing the couldn't find DSO to load: libhermes.so issue:
ref: facebook/react-native#29528 (comment)
@facebook facebook locked as resolved and limited conversation to collaborators Nov 27, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Nov 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Attention Issues where the author has responded to feedback. Newer Patch Available Resolution: Locked This issue was locked by the bot. Tech: Hermes Hermes Engine: https://hermesengine.dev/
Projects
None yet
Development

No branches or pull requests