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

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

Closed
cortinico opened this issue Mar 20, 2023 · 9 comments
Closed

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

cortinico opened this issue Mar 20, 2023 · 9 comments

Comments

@cortinico
Copy link
Contributor

  • 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)

@cortinico
Copy link
Contributor Author

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

@NguyenHoangMinhkkkk
Copy link

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

@poojasolanki9569
Copy link

poojasolanki9569 commented Apr 12, 2023

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?

@rada
Copy link

rada commented May 9, 2023

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.

@cortinico
Copy link
Contributor Author

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

@NguyenHoangMinhkkkk
Copy link

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 🚀

@vlack-coder
Copy link

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

@mansilaad19
Copy link

mansilaad19 commented Jul 10, 2023

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

@anhquan291
Copy link

anhquan291 commented Aug 11, 2023

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants