Skip to content

Reproducer for: "couldn't find DSO to load: libhermes.so caused by" #36539

Closed

Description

@cortinico
  • i created a project for reproducing this crash of java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
  • hope it help here to debug this crash.

**Step reproduce:

  • Init project: npx react-native init Test0714

  • android/gradle.properties -> newArchEnabled true

  • add @react-native-firebase/app

  • register firebase console -> add google-services.json (packageName: "com.test0714") to dir: /android/app

  • rnfirebase docs: => cd android && ./gradlew signingReport

  • add "classpath 'com.google.gms:google-services:4.3.15'" into dir: /android/build.gradle

  • Lastly, execute the plugin by adding the following to your /android/app/build.gradle file:
    ->apply plugin: 'com.google.gms.google-services' // <- Add this line

  • In File: /android/app/build.gradle
    => add these lines: "multiDexEnabled true" and "implementation 'androidx.multidex:multidex:2.0.1'"

  • yarn add @react-native-firebase/messaging

  • yarn add @react-native-firebase/crashlytics

    • android/build.gradle add line: "classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.4'"
    • android/app/build.gradle add line: "apply plugin: 'com.google.firebase.crashlytics'"

// run-android here working fine.

/ / / / / / / /
// Crash after do these things with react-native-code-push
// adb logcat ==> java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so

  • yarn add react-native-code-push

    • android/setting.gradle:
      include ':app', ':react-native-code-push'
      project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')

    • android/app/build.gradle
      apply from: "../../node_modules/react-native/react.gradle"
      apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

    • update MainApplication.java
      // 1. Import the plugin class.
      import com.microsoft.codepush.react.CodePush;

      //
      @OverRide
      protected String getJSBundleFile() {
      return CodePush.getJSBundleFile();
      }

  • Run build: npx react-native run-android**

https://github.com/NguyenHoangMinhkkkk/reproduce-0714-crash

Originally posted by @NguyenHoangMinhkkkk in #35895 (comment)

Activity

  1. cortinico commented on Mar 20, 2023

    @cortinico
    ContributorAuthor

    Can someone try the reproducer provided by @NguyenHoangMinhkkkk and verify that it consistently happening?

  2. NguyenHoangMinhkkkk commented on Mar 21, 2023

    @NguyenHoangMinhkkkk

    And one more thing.
    in gradle.properties, if hermesEnabled set as false then the app works.

  3. poojasolanki9569 commented on Apr 12, 2023

    @poojasolanki9569

    I can able to reproduce this issue 'couldn't find DSO to load' in the latest react-native 0.71.6 with hermesEnabled true, Can someone help, please?

  4. rada commented on May 9, 2023

    @rada

    This is happening because of this line (apply from: "../../node_modules/react-native/react.gradle") in app/buil.gradle. This is required by older versions of codepush however they fixed it in the latest release.

    Fix:

    1. remove
      apply from: "../../node_modules/react-native/react.gradle"
      from app/build.gradle
    2. Update react-native-code-push to v8.0.1
    3. rebuild android and you should be good to go

    You can confirm the apply from: "../../node_modules/react-native/react.gradle" is the problem by creating a new project in RN and adding this line in the app/build.gradle.

    And also double check code-push is working for you.

  5. cortinico commented on May 9, 2023

    @cortinico
    ContributorAuthor

    This is happening because of this line (apply from: "../../node_modules/react-native/react.gradle") in app/buil.gradle. This is required by older versions of codepush however they fixed it in the latest release.

    Thanks for verifying this @rada You're right that line is unnecessary.
    Closing as this is now solved

  6. NguyenHoangMinhkkkk commented on May 9, 2023

    @NguyenHoangMinhkkkk

    This is happening because of this line (apply from: "../../node_modules/react-native/react.gradle") in app/buil.gradle. This is required by older versions of codepush however they fixed it in the latest release.

    Fix:

    1. remove
      apply from: "../../node_modules/react-native/react.gradle"
      from app/build.gradle
    2. Update react-native-code-push to v8.0.1
    3. rebuild android and you should be good to go

    You can confirm the apply from: "../../node_modules/react-native/react.gradle" is the problem by creating a new project in RN and adding this line in the app/build.gradle.

    And also double check code-push is working for you.

    Thanks 🚀

  7. vlack-coder commented on May 17, 2023

    @vlack-coder

    This is happening because of this line (apply from: "../../node_modules/react-native/react.gradle") in app/buil.gradle. This is required by older versions of codepush however they fixed it in the latest release.

    Fix:

    1. remove
      apply from: "../../node_modules/react-native/react.gradle"
      from app/build.gradle
    2. Update react-native-code-push to v8.0.1
    3. rebuild android and you should be good to go

    You can confirm the apply from: "../../node_modules/react-native/react.gradle" is the problem by creating a new project in RN and adding this line in the app/build.gradle.

    And also double check code-push is working for you.

    Worked perfectly

  8. mansilaad19 commented on Jul 10, 2023

    @mansilaad19

    This is happening because of this line (apply from: "../../node_modules/react-native/react.gradle") in app/buil.gradle. This is required by older versions of codepush however they fixed it in the latest release.

    Fix:

    1. remove
      apply from: "../../node_modules/react-native/react.gradle"
      from app/build.gradle
    2. Update react-native-code-push to v8.0.1
    3. rebuild android and you should be good to go

    You can confirm the apply from: "../../node_modules/react-native/react.gradle" is the problem by creating a new project in RN and adding this line in the app/build.gradle.

    And also double check code-push is working for you.

    Thank you @rada

  9. anhquan291 commented on Aug 11, 2023

    @anhquan291

    @rada Hi guys,
    Thank you so much it works for me in Debug mode. However when it comes to release mode, the app build successfully but pictures are shown...I have to add apply from: "../../node_modules/react-native/react.gradle" for the release App to work! It is so annoying.
    Any ideas guys? Thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions