react-native\react.gradle' 不存在 [英] react-native\react.gradle' does not exist
问题描述
我使用 react native 创建了一个应用程序,我正在尝试生成 apk.在 http://facebook 的文档中做了所有事情之后.github.io/react-native/docs/signed-apk-android.html#content.发生错误,它说无法读取脚本 react-native\react.gradle' 因为它不存在.
I created an app using react native and I am trying to generate the apk. After doing everthing in the doc of http://facebook.github.io/react-native/docs/signed-apk-android.html#content. An error occured and it says Could not read script react-native\react.gradle' as it does not exist.
这里是错误
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\User\Desktop\Aaa\android\app\build.gradle' line: 68
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not read script 'C
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
推荐答案
转到项目的根文件夹并运行 npm install
它将生成必要的文件,包括 react.gradle代码>
Go to the project's root folder and run npm install
and it will generate the necessary files, including react.gradle
如果你没有 node.js,你可以从这里下载:https://nodejs.org/en/download/
If you don't have node.js, you can download it from here: https://nodejs.org/en/download/
这篇关于react-native\react.gradle' 不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!