react-native: [0.60.3] App crash on startup when enabling Hermes (enableHermes: true)

App is crashing when I enable Hermes in android/app/build.gradle. App is working fine with react-native 0.60.3 with enableHermes: false

Error:

07-12 08:06:59.097 20330-20330/com.reactnativememoryprofile E/SoLoader: couldn't find DSO to load: libjscexecutor.so 07-12 08:06:59.123 20330-20345/com.reactnativememoryprofile E/SoLoader: couldn't find DSO to load: libhermes.so 07-12 08:06:59.124 20330-20345/com.reactnativememoryprofile E/AndroidRuntime: FATAL EXCEPTION: create_react_context Process: com.reactnativememoryprofile, PID: 20330 java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738) at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484) at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20) at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:27) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:949) at java.lang.Thread.run(Thread.java:818)

React Native version: System: OS: macOS 10.14.5 CPU: (12) x64 Intel® Core™ i7-8750H CPU @ 2.20GHz Memory: 373.31 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.15.1 - /usr/local/bin/node Yarn: 1.13.0 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2 Android SDK: API Levels: 23, 24, 25, 26, 27, 28 Build Tools: 21.1.2, 23.0.1, 25.0.0, 25.0.1, 25.0.2, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.2, 28.0.3, 29.0.0 System Images: android-23 | Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-27 | Android TV Intel x86 Atom, android-27 | Intel x86 Atom, android-27 | Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64 Android NDK: 20.0.5594570 IDEs: Android Studio: 3.4 AI-183.6156.11.34.5522156 Xcode: 10.2/10E125 - /usr/bin/xcodebuild npmPackages: react: 16.8.6 => 16.8.6 react-native: ^0.60.3 => 0.60.3 npmGlobalPackages: react-native-cli: 2.0.1 react-native-create-library: 3.1.2 react-native-git-upgrade: 0.2.7 m-c02xf2cejg5h:reactNativeMemoryProfi

Steps To Reproduce

  1. Follow the steps mentioned in hermes
  2. react-native run-android --variant release

Describe what you expected to happen: App should not crash

Snack, code example, or link to a repository:

https://github.com/bhaskarGyan/react-native-memory-profile/tree/bug/rn-0.60.3_hermes

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 49
  • Comments: 122 (7 by maintainers)

Most upvoted comments

Same issues

If you have additional build types those will need to be added too, e.g.

    integrationImplementation files(hermesPath + "hermes-release.aar")
    stagingImplementation files(hermesPath + "hermes-release.aar")

Because we have a few build types, and apart from debug they should all be in release mode, I also had to add some react.gradle fixes. We have a custom react.gradle so this wasn’t too much trouble. Basically changing targetName.toLowerCase().contains("release") to !targetName.toLowerCase().contains("debug").

if (!targetName.toLowerCase().contains("debug")) {
    // Can't use ?: since that will also substitute valid empty lists
    hermesFlags = config.hermesFlagsRelease
    if (hermesFlags == null) hermesFlags = ["-O", "-output-source-map"]
} else {
    hermesFlags = config.hermesFlagsDebug
    if (hermesFlags == null) hermesFlags = []
}

and

// Delete the VM related libraries that this build doesn't need.
// The application can manage this manually by setting 'enableVmCleanup: false'
//
// This should really be done by packaging all Hermes releated libs into
// two separate HermesDebug and HermesRelease AARs, but until then we'll
// kludge it by deleting the .so files out of the /transforms/ directory.
def isRelease = !targetName.toLowerCase().contains("debug")

Also added a quick fix for #25609

ant.move(
    file: jsBundleFile,
    tofile: "${jsBundleFile}_temp"
);
commandLine(getHermesCommand(), "-emit-binary", "-out", jsBundleFile, "${jsBundleFile}_temp", *hermesFlags)

you’ll need to add

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

at the top of your build.gradle file and

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

in your dependencies.

Should we move those bits of configuration to react.gradle?

In my case I saw this crash when:

  1. I first build release with enableHermes: false
  2. Change enableHermes: true
  3. Build release

all while

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

and

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

were present.

Crash disappears after cleaning the build: cd android && ./gradlew clean

The same thing is happening to me, the build is successful, but:

  1. The metro bundler doesn’t start up
  2. I have this error 2019-07-12 09:26:37.060 4759-4796/com.tests E/SoLoader: couldn't find DSO to load: libhermes.so --------- beginning of crash 2019-07-12 09:26:37.062 4759-4796/com.sherlock E/AndroidRuntime: FATAL EXCEPTION: create_react_context Process: com.tests, PID: 4759 java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738) at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484) at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20) at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:27) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:949) at java.lang.Thread.run(Thread.java:764)

If you enable hermes - you will get 2x error couldn't find DSO to load: libhermes.so If you disable hermes - you will get only once couldn't find DSO to load: libhermes.so

So in conclusion you cant disable that nonsense and your app will crash no matter what. Seems like we will have to wait for a year or so until they come up with the proper documentation on how to upgrade to RN 6

I’ve been able to follow these steps to get split APKs and universal APKs launching correctly for staging and release builds. I have not been able to get it working for .aab bundles. I build the bundle and when I install the application, it results in a hanging white screen on startup. Has anybody come across a similar issue?

same issue here it builds fine but crashes on start up

I, following the guide set enableHermes to true but cant see any global variable named HermesInternal.

Install Hermes Engine. NPM

@SourceCipher Yes, it works, these are the bits from my app/build.gradle

project.ext.react = [
    entryFile: "index.android.js",
    enableHermes: false
]

def enableHermes = project.ext.react.get("enableHermes", false);
def jscFlavor = 'org.webkit:android-jsc:+'
def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

// ... later on ....

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

After that, though I ran into red screen issues connecting to 10.0.2.2:8081, which I solved by modifying AndroidManifest.xml:

<application
     android:usesCleartextTraffic="true"
     ....

In my case I had “hermes-engine” folder instead of “hermesvm” under node_modules so when I changed the folder name to hermes-engine in the app’s build.gradle the error was gone (my RN version is 0.61.0)

on RN 0.61.1 this problem seems resolved so i would suggest upgrading your RN version.

1-upgrade react-native to 0.61 2-enable hermes

project.ext.react = [
    entryFile: "index.js",
    enableHermes: true
]
def enableHermes = project.ext.react.get("enableHermes", true);

3-add in android/app/build.gradle

android {
...
packagingOptions{
         exclude '**/libhermes-inspector.so'
         exclude '**/libhermes-executor-debug.so'
         exclude '**/libjscexecutor.so'
    }
...
}

Still an issue on 0.61.0 aswell.

My working solution (using RN 0.60.4)

  1. Copy react.gradle to android > app
  2. In build.gradle, change
apply from: "../../node_modules/react-native/react.gradle"

to

apply from: "./react.gradle"

and

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

to

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";  //  <-- change this
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
  1. Install hermes-engine (0.1.1)
yarn add -D hermes-engine
  1. Run project in release mode
react-native run-android --variant release

@HarshitMadhav I got the same error as you were

com.facebook.jni.CppException: Wrong bytecode version. Expected 59 but got 60

In your case, I think you should check step 2 to change hermesPath

It is now working. Problem: I made a mistake not to refer to https://github.com/react-native-community/rn-diff-purge/compare/release%2F0.60.0..release%2F0.60.3?diff=split while upgrading the App from 0.60.0 to 0.60.3.

After modification of relevent file mentioned in above url and cd android && ./gradlew clean, the app is working as expected with Hermes enabled.

Link to commit in my repo for these changes -> https://github.com/bhaskarGyan/react-native-memory-profile/commit/3d05ebc0391217c39d6615f6e2c1804890d69f5c

@bhaskarGyan I init project from react native cli, with version 0.60.3, and still meet the problem with couldn't find DSO to load: libhermes.so

Any clue for that?

Thanks

@SourceCipher And the issue is CLOSED. Boom.

@Devlin556 did you copy react.gradle from node_modules/react-native/react.gradle to android/app/react.gradle?

When you’ve done that, make the two changes shown above - both involve changing targetName.toLowerCase().contains("release") to !targetName.toLowerCase().contains("debug")

Probably worth running (cd android && ./gradlew clean) afterwards too before trying to build again.

BTW I haven’t tried RN 0.61 yet but in my few hours experience with Hermes, my impression was that this isn’t really ready for production use, given that it doesn’t even work on a fresh 0.60.5 app without multiple workarounds. It’s also super slow (maybe 3-5x slowdown) compared to JSC in debug mode with our app and I experienced some crashes. Assuming Facebook are using this internally I’m sure the situation will improve rapidly though.

Same problem here, using RN 0.60.3.

I followed this (https://react-native-community.github.io/upgrade-helper/?from=0.59.9&to=0.60.3) to upgrade my app from RN 0.59.9 to 0.60.3 and have added all the necessary configs for Android from there.

The app runs normally when Hermes is not enabled. However, once Hermes is enabled by following the step here (https://facebook.github.io/react-native/docs/hermes), the app can build, can start up and show the splash screen - but crashes immediately after the splash screen is done. Couldn’t find any solution yet. Hope this provides a bit of extra information needed to debug this.

Same issue after setting: project.ext.react = [ entryFile: “index.js”, enableHermes: true // clean and rebuild if changing ] App build fine but crash on startup :

Fatal Exception: java.lang.UnsatisfiedLinkError com.facebook.soloader.SoLoader.doLoadLibraryBySoName

Thanks @aliozinan !

I’m on RN 0.61.2 and fixed by replacing hermesvm with hermes-engine in android/app/build.gradle, like this:

def hermesPath = "../../node_modules/hermes-engine/android/";

Now everything works properly.

For anyone having this issue, this may help.

From React native docs:

Note about Android App Bundles Android app bundles are not yet supported with hermes

That means Hermes is only for .apk. I was really had a headache because my release .aab stucks on splash screen 🤣

Hope this help

Update: Hermes is now supported since RN 0.62 and up

For people with more build types (let’s call it anotherDebug):


// In dependencies {}:
    debugImplementation files(hermesPath + "hermes-debug.aar")
    anotherDebugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")

// This is where the build types are specified (in buildTypes {}):
        anotherDebug {
            initWith buildTypes.debug
            matchingFallbacks = ['debug'] // For libs that don't have this build type
            // Add stuff that makes anotherDebug necessary for you
        }

Can somebody open up this issue. There are still lots of us with this problem? Cc: @bhaskarGyan

Has anyone been successful at running a release version with Hermes enabled from the Play Store?

I can run a react-native run-android --variant release build on my phone without issue, but if I do a ./gradlew bundleRelease and upload the aab file to the Google store, when I attempt to run that version on my phone, I just get a black screen after a long delay.

Firebase Crashlytics shows the following:

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName + 738(SoLoader.java:738)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName + 591(SoLoader.java:591)
       at com.facebook.soloader.SoLoader.loadLibrary + 529(SoLoader.java:529)
       at com.facebook.soloader.SoLoader.loadLibrary + 484(SoLoader.java:484)
       at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit> + 20(HermesExecutor.java:20)
       at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create + 27(HermesExecutorFactory.java:27)
       at com.facebook.react.ReactInstanceManager$5.run + 949(ReactInstanceManager.java:949)
       at java.lang.Thread.run + 818(Thread.java:818)

Any thoughts?

I think I passed this issue, via ./gradlew clean, but now I have problem same as #25599 when run with --variant release

In my case I had “hermes-engine” folder instead of “hermesvm” under node_modules so when I changed the folder name to hermes-engine in the app’s build.gradle the error was gone (my RN version is 0.61.0)

on RN 0.61.1 this problem seems resolved so i would suggest upgrading your RN version.

This worked for me!

Herms is still not working on release variant in react native “0.60.5” on react-native init project. Debug variant is fine.

Should be this as of RN 0.60.4

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
    }
    // ....
}

@maitrungduc1410 oh my god, I’ve been banging my head on the wall for hours with that.

That being said, it now says:

Android app bundles are supported from react-native 0.62.0 and up. so 0.63.2 shouldn’t be affected.

After enabling Hermes in your project, Please update the Hermes path in “android/app/build.gradle” file. You can see the sample code below.

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

After the update of hermesPath, run your application react-native run-android. Hermes issue has been fixed.

I do have the same issue

Error: Command failed: gradlew.bat app:installRelease -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command '..\..\node_modules\hermesvm\win64-bin\hermes''
  if (enableHermes) {
    def hermesPath = "../../node_modules/hermesvm/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
  } else {

// @benoitdion where are we initialising the variable jscFlavor?

implementation jscFlavor

}


in your dependencies.

Should we move those bits of configuration to `react.gradle`?

@benoitdion, If possible then Yes please since I believe user should not be worried about these kind of one time configuration. It would be great if these bits of config move to react.gradle

For people with more build types (let’s call it anotherDebug):


// In dependencies {}:
    debugImplementation files(hermesPath + "hermes-debug.aar")
    anotherDebugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")

// This is where the build types are specified (in buildTypes {}):
        anotherDebug {
            initWith buildTypes.debug
            matchingFallbacks = ['debug'] // For libs that don't have this build type
            // Add stuff that makes anotherDebug necessary for you
        }

This solved my issue, thank you @nokite .

I solved this by four steps.

  1. copy some code from offical template 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);

if (enableHermes) { def hermesPath = "../../node_modules/hermesvm/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar") } else { implementation jscFlavor } 2. npm install hermesvm 3. change enableHermes: false to enableHermes: true 4. clean project and rebuild,then success


I alse have a question.When set ‘enableHermes’ to false,that means i don’t want to use hermes,i also got the problem.That confused me a lot.

Just resolved that issue on my side. The problem was when I assemble with buildType “releaseStaging”. I added : releaseStagingImplementation files(hermesPath + “hermes-release.aar”) near to debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar")

@ebwinters I think you should edit the next code:

        mavenLocal()
        jcenter {
            url "http://jcenter.bintray.com/"
        }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }

to this:

        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        jcenter {
            url "http://jcenter.bintray.com/"
        }
        mavenLocal()

Thanks for helping bro. I’ve resolved my issue too.

You saved my life. Thanks a lot =)

Don’t forget to add def jscFlavor = 'org.webkit:android-jsc:+'

@ebwinters I think you should edit the next code:

        mavenLocal()
        jcenter {
            url "http://jcenter.bintray.com/"
        }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }

to this:

        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        jcenter {
            url "http://jcenter.bintray.com/"
        }
        mavenLocal()

@mjmasn After update to the latest version RN@0.60.3

I have got this error when I run my app

And in my project I do not enable Hermes!

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

I had the exact same issue, with none of the steps above working. I eventually realized that when I ran npx react-native upgrade I had some conflicts that never made it to the diff. By examining rn-diff-purge I was able to apply the manual updates needed to my build.gradle files, gradle-wrapper, and other android areas. It now works as expected!

Same issue here.

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

In my case I saw this crash when:

  1. I first build release with enableHermes: false
  2. Change enableHermes: true
  3. Build release

all while

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

and

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

were present.

Crash disappears after cleaning the build: cd android && ./gradlew clean

i did the same thing, alongwith “def enableProguardInReleaseBuilds = false” in the same file, but when i pushed my app bundle to play store it is crashing on startup.

In my case I had “hermes-engine” folder instead of “hermesvm” under node_modules so when I changed the folder name to hermes-engine in the app’s build.gradle the error was gone (my RN version is 0.61.0)

on RN 0.61.1 this problem seems resolved so i would suggest upgrading your RN version.

Doesn’t work.

https://github.com/facebook/react-native/issues/27116

I got the same error (couldn’t find DSO to load: libhermes.so) even with hermes disabled and without changing any gradle file apparently. After looking at the logcat I saw the initial error few lines above:

dlopen failed: library “libjsc.so” not found

and I guess the hermes error happens because of the fallback. Then after double check my gradle files I found the issue (at least for me)

I had this in my root build.gradle:

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

where I added jitpack because of a 3rd party library requirement.

After changing to this (separate blocks):

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

The issue is gone and app doesn’t crash anymore. So it looks like build succeeds but resulting APK doesn’t contain the right ‘jsc’ libraries, probably because download fails in the maven directive (don’t have a real explanation btw).

0.60.4 still face this issue.

OK for me, I had to add jsc to android/build.gradle, because it’ll otherwise try to load hermes by default:

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

I can’t figure this out. I’ve followed most of the advice and this still crashes even when hermes is disabled. Any idea why? Where exactly is this libhermes.so supposed to be?

I just managed to upgrade my entire project to react native “0.60.5”. I was so fed up trying to change various settings which never worked so I did everything from scratch.

Basically you have to create the new project using react-native init <ProjectName> and start installing all the libraries you are using and adding their settings. For example, I used facebook login apk and some of the firebase libraries. I installed 1 by 1 and added their corresponding settings. After tweaking couple of things, everything built up and works fine!

By default hermes is disabled and dont even try to enable it 😃

Tried the above configurations many times and the app crashes with the same error no matter what. Its a shame as after upgrading to RN 6 it seemed like everything was up to date, no errors nothing all clean and shiny, all compiled and launched but crashing on startup.

I have tried @gpawlik solution and even pointing to both hermes-engine and hermesvm but the same issue.

I kind of want to try and build the new project and start applying my current project settings to see when it crashes, but I rather spend my 12h doing something better …

EDITED: I just tried creating new react native 6+ project with enabled hermes engine or disabled. Both cases worked fine. I copied every single setting, package, upgraded everything to their versions point to point and still getting the same issue. I give up

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

If like @SourceCipher you’re having issues disabling hermes, check out the solution in this thread to add url("$rootDir/../node_modules/jsc-android/dist")

Hmmm, it could be happen by magic, but the error went away … now I can at least build a .aab for PlayStore which doesn’t crash. RN is 60.5 … and the only thing I am aware that I’ve changed is in android/build.gradle from 3.4.2 downgrade to 3.4.1:

classpath("com.android.tools.build:gradle:3.4.1")

I assume Android Studio asked me to upgrade it a couple of days ago … but maybe it is just a magic.

I, following the guide set enableHermes to true but cant see any global variable named HermesInternal.

did you solve it?

You have to add the following conditional dependencies:

Globals:

/**
 * The preferred build flavor of JavaScriptCore.
 *
 * For example, to use the international variant, you can use:
 * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
 *
 * The international variant includes ICU i18n library and necessary data
 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
 * give correct results when using with locales other than en-US.  Note that
 * this variant is about 6MiB larger per architecture than default.
 */
def jscFlavor = 'org.webkit:android-jsc:+'

/**
 * Whether to enable the Hermes VM.
 *
 * This should be set on project.ext.react and mirrored here.  If it is not set
 * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
 * and the benefits of using Hermes will therefore be sharply reduced.
 */
def enableHermes = project.ext.react.get("enableHermes", false);

In Android Section:

packagingOptions {
        pickFirst 'lib/x86/libc++_shared.so'
        pickFirst 'lib/arm64-v8a/libc++_shared.so'
        pickFirst 'lib/x86_64/libc++_shared.so'
        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
    }

In Dependencies Section

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

For me Hermes is not working I dont know why? My app size is that much as it was before enabling Hermes

@sriraman I wish I had documented exactly the steps I took to solve this issue, because it took a couple days of banging my head against the wall to get it. The best advice I can give you in absence of what I did step by step is the follow the upgrade helper and to look at all threads on StackOverflow in addition to GH pertaining to this issue. There were a lot of useful solutions specifically here and here

@ebwinters read the theme, we solved our problems

@bhaskarGyan I init project from react native cli, with version 0.60.3, and still meet the problem with couldn't find DSO to load: libhermes.so

Any clue for that?

Thanks

Same here. What u did to fix it?

@yjkimjunior @vijayhfs that’s a different issue with libjsc, nothing to do with this Hermes issue.

The solution is in these two comments: https://github.com/facebook/react-native/issues/25601#issuecomment-510850228 https://github.com/facebook/react-native/issues/25601#issuecomment-510856047

The important thing is that upgrading React Native is not (usually) simply a case of updating the version number in package.json. Use https://react-native-community.github.io/upgrade-helper/ to see which files need to be modified between two versions, or use the react-native upgrade command.