honor
honor

Reputation: 8138

react-native android app quits before it launches (0.61.2) - couldn't find DSO to load: libhermes.so - Channel is unrecoverably broken

I have been trying to migrate from react-native 0.59.4 to 0.61.2.

After solving many many build and runtime problems on ios and android, this was the final problem before the successful launch of my react-native app on android. The app would build successfully but when it is time to launch on the emulator it would pop for a very brief moment then a white screen and application crashed with an app keeps crashing type of popup message. I can't even debug the app remotely on the chrome console since it doesn't launch in the first place.

Any ideas?

Upvotes: 0

Views: 360

Answers (1)

honor
honor

Reputation: 8138

Note: This solution worked for my specific problem. To find out your problem try adb logcat *:E to see what is wrong in your case.

Ok, there is a very important command (I am on mac) that helps you see in the logs what is going on even if you can't launch the app on emulator: adb logcat *:E

In my case there were 2 main problems that caught my attention in the logs.

Channel is unrecoverably broken and will be disposed

and

couldn't find DSO to load: libhermes.so

Once I got these messages on my radar I started to dig/google for them.

After going through a lot of SO and GitHub topics here is what worked for me:

First, make sure you have made all the necessary modifications in your:

  • gradle.properties
  • app/build.gradle
  • android/build.gradle
  • package.json
  • etc

files (Use react-native upgrade helper to do this).

Then, if it is not installed already, do npm install jsc-android to install the required jsc package on your project.

Add the below in android/build.graddle inside allprojects -> repositories

    maven {
        // Android JSC is installed from npm
        url("$rootDir/../node_modules/jsc-android/dist")
    }

Inside gradle.properties add

android.useAndroidX=true
android.enableJetifier=true

In some cases you may need to add below line to package.json

"postinstall": "npx jetify"

Also, in some cases it may help to replace the below line (dependencies section of app/build.gradle) with the exact version of the react-native you are using:

implementation "com.facebook.react:react-native:+"

Replace like so:

implementation "com.facebook.react:react-native:**0.61.2**"

I hope this helps to solve or at least make some progress with your problem. Cheers.

Upvotes: 2

Related Questions