簡體   English   中英

Hermes 不適用於帶有 React-native 0.60.2 的 Android

[英]Hermes is not working in Android with React-native 0.60.2

我已經通過更改 package.json 將現有(非新)項目中的 React-native 升級到 0.60.2,如下所示https://react-native-community.github.io/upgrade-helper/?from=0.59 .10&to=0.60.2

在 android/app/build.gradle 我放: p

roject.ext.react = [
    entryFile: "index.js",
    enableHermes: true  // clean and rebuild if changing
] 

構建成功,但 Hermes 似乎不起作用,在 RN 0.59.0 apk 中為 29 Mb,現在為 46 Mb。

如果我在這里對 build.gradle 添加其他更改https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.2

然后我得到錯誤:無法讀取腳本 '/Users/mac/Desktop/aqua2/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' 因為它不存在。

可能是因為最后一行:

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

我該如何解決這個問題?

您應該為 applyNativeModulesAppBuildGradle 函數提供第二個參數。 我從你的文件方向得到的,你的根在上面。 這就是為什么我說你應該把你的根方向作為第二個參數。

  • 你的節點模塊方向

    文件(“../../node_modules/

  • 你應該這樣做

    applyNativeModulesAppBuildGradle (項目, “../”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM