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

Solution 1:

I had the same issue after upgrading from 0.59.8 to 0.60.4

Make sure you have added all these lines in your app/build.gradle, especially the dependencies part as this makes sure you have JSC binary

project.ext.react = [

...
    // your index js if not default, other settings
  // Hermes JSC ?
 enableHermes: false,

...
]

def jscFlavor = 'org.webkit:android-jsc:+'

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

dependencies {

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules

    if (enableHermes) {
      // For RN 0.60.x
      def hermesPath = "../../node_modules/hermesvm/android/"

      // --- OR ----          

      // for RN 0.61+
      def hermesPath = "../../node_modules/hermes-engine/android/";


      debugImplementation files(hermesPath + "hermes-debug.aar")
      releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
      implementation jscFlavor
    }

EDIT

Also, make sure the Hermes Maven repo is in your root build.gradle

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

Solution 2:

I've just cleaned the build folder for android and after that, it worked fine. Hope that helps mate.

cd android
./gradlew clean 

Solution 3:

I added this block in allProject block in project_dir/build.gradle and the crash went away.

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

What I did is to create new project with react-native init and went through the android build files. Fortunately this one was the first difference I noticed and fixed my issue. I guess you could do the same if this doesn't work.