我已通过更改package.json(如此处https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.2
的方式,将现有(不是新的)项目中的React-native升级到0.60.2。在android / app / build.gradle中,我输入: p
roject.ext.react = [
entryFile: "index.js",
enableHermes: true // clean and rebuild if changing
]
构建成功,但是爱马仕似乎无法正常工作,在RN 0.59.0中,apk为29 Mb,现在为46 Mb。
如果我在此处https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.2
中对build.gradle添加其他更改然后我得到错误: 无法读取脚本'/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)
我该如何解决?
答案 0 :(得分:0)
您应该将第二个参数赋予applyNativeModulesAppBuildGradle函数。我从您的文件方向获取信息,您的根目录居上。这就是为什么我说你应该把你的根本方向作为第二个参数。
您的节点模块的方向
文件(“ ../../ node_modules /
您应该这样做
applyNativeModulesAppBuildGradle (项目,“ ../” )