最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - hermes has error in release build of react-native 0.60.5 - Stack Overflow

programmeradmin3浏览0评论

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?

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?

Share Improve this question edited Aug 18, 2019 at 12:05 Mahyar Fard asked Aug 18, 2019 at 11:59 Mahyar FardMahyar Fard 7351 gold badge6 silver badges13 bronze badges 2
  • If your question has been answered, please make sure to accept and vote up an answer for further references. – MoKhajavi75 Commented Aug 18, 2019 at 14:19
  • You should put the error trace as text. Not only the image trace looks of low quality also it's not searchable. – red-devil Commented Nov 4, 2019 at 23:42
Add a ment  | 

1 Answer 1

Reset to default 6

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",
    ...
]

UPDATE

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 .facebook.hermes.unicode.* { *; }

then clean via gradlew clean and finally:

gradlew assembleRelease

发布评论

评论列表(0)

  1. 暂无评论