react-native - react-native\react.gradle'不存在

标签 react-native

我使用react native创建了一个应用程序,我正在尝试生成apk。在http://facebook.github.io/react-native/docs/signed-apk-android.html#content文档中做了一切之后。发生错误,提示
无法读取脚本react-native \ react.gradle',因为它不存在。

这是错误

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
如果没有node.js,则可以从此处下载:https://nodejs.org/en/download/

关于react-native - react-native\react.gradle'不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44437554/

相关文章:

ios - 如果我共享我的 React-Native 应用程序,我是否需要将 ios 和 android 文件夹放入源代码管理中?

javascript - 如何在 react-native 中更改占位符 textSize

javascript - 尽管同一模型在另一个文件中工作,但我收到了 "User.findOne is not a function"错误消息。类似问题的答案无效

react-native - 找不到变量 : Component in react native

react-native - 如何在React Native中输入 'xxx-xxx-xxxx'格式的电话号码?

javascript - React Native 渲染函数抛出错误

reactjs - 如何为多个API请求配置redux reducer ?

post - 在 React Native 中使用 POST 方法下载二进制文件

react-native - 在向后滑动时执行操作( react 导航)

node.js - 当我运行 "expo init my-app"时,我无法使用 expo 构建项目(React Native 和 Node)