I upgraded my react-native project from 0.59.4 to 0.60.5 and everything works well. I tried to take release build without Hermes and everything is ok but when I enabled Hermes option in android/app/build.gradle and tried to take release build, I got an error as below:

how to solve this problem and enable Hermes for my project?
First, try to clean the node_modules and install it again via yarn.
This issue has been fixed in this PR.
You can also fix it by changing the android/app/build.gradle to:
project.ext.react = [
...
hermesCommand: "../../node_modules/hermesvm/%OS-BIN%/hermes",
...
]
first add new hermes via:
yarn add --dev [email protected]
then in android/app/build.gradle:
project.ext.react = [
entryFile: "index.js",
enableHermes: true, // clean and rebuild if changing
hermesCommand: "../../node_modules/hermes-engine/%OS-BIN%/hermes",
]
and also change this:
def hermesPath = "../../node_modules/hermesvm/android/";
to this:
def hermesPath = "../../node_modules/hermes-engine/android/";
then replace node_module/react-native/react.gradle with this file.
If you use Proguard/R8, add this to android/app/proguard-rules.pro:
-keep class com.facebook.hermes.unicode.* { *; }
then clean via gradlew clean and finally:
gradlew assembleRelease
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With