React Native错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort = 8081

时间:2020-05-16 10:28:09

标签: react-native

反应本机错误无法安装应用程序。确保已设置Android开发环境:https://reactnative.dev/docs/environment-setup。使用--verbose标志运行CLI以获取更多详细信息。 错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort = 8081

失败:构建失败,并出现异常。

  • 出了什么问题: 无法初始化org.codehaus.groovy.runtime.InvokerHelper类

  • 尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行,以获取更多日志输出。使用--scan运行以获取完整的见解。

  • https://help.gradle.org

  • 获得更多帮助

在663毫秒内无法完成

at makeError (C:\dea\node_modules\execa\index.js:174:9)
at C:\dea\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (C:\dea\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\dea\node_modules\@react-native-community\cli\build\index.js:186:9)

我该如何解决这个问题?请帮助

1 个答案:

答案 0 :(得分:0)

此问题是由于gradle版本引起的。您可以通过以下方式修复它:

  • 首先,转到android目录并找到build.gradle文件
  • 打开build.gradle文件
  • distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip更改为 distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip,使用gradle-6.3
  • cmd运行react-native run-android