简体   繁体   English

ReactNative,Android运行错误:无法从'11 .0.1'确定java版本。 Windows 10

[英]ReactNative, Android run error: Could not determine java version from '11.0.1'. Windows 10

Java version: 11.0.1 React Native version: 0.57.5 React Native CLI version: 2.0.1 Java版本: 11.0.1 React Native版本:0.57.5 React Native CLI版本:2.0.1

Android device is connected and given access, tuned on debug via USB Android设备已连接并具有访问权限,可通过USB进行调试

When I run neact-native run android I get this following error: 当我运行neact-native运行android我得到以下错误:

Starting JS server... Building and installing the app on the device (cd android && gradlew.bat installDebug)... 启动JS服务器...在设备上构建和安装应用程序(cd android && gradlew.bat installDebug)...

FAILURE: Build failed with an exception. FAILURE:构建因异常而失败。

  • What went wrong: Could not determine java version from '11.0.1'. 出了什么问题:无法确定'11 .0.1'中的java版本。

  • Try: Run with --stacktrace option to get the stack trace. 尝试:使用--stacktrace选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output. 使用--info或--debug选项运行以获取更多日志输出。 Run with --scan to get full insights. 使用--scan运行以获得完整的见解。

  • Get more help at https://help.gradle.org Could not install the app on the device, read the error above for details. https://help.gradle.org获取更多帮助无法在设备上安装应用程序,请阅读上面的错误以获取详细信息。 Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html 确保您运行的是Android模拟器或已连接设备并设置了Android开发环境: https//facebook.github.io/react-native/docs/getting-started.html

You seem to be using an older version of Gradle, from 4.8+ your project should build 您似乎正在使用旧版本的Gradle,从4.8+以上您的项目应该构建

The below directory gradle/ is in whichever directory gradlew or gradlew.bat is in. 以下目录gradle/位于gradlewgradlew.bat所在的目录中。

  • Edit the file called gradle-wrapper.properties located in ./path-to-project-root/gradle/wrapper 编辑位于./path-to-project-root/gradle/wrapper名为gradle-wrapper.properties的文件
  • Replace distributionUrl:... with the following 使用以下内容替换distributionUrl:...

distributionUrl=http\\://services.gradle.org/distributions/gradle-5.0-bin.zip

I was having the same issue. 我遇到了同样的问题。 I update the gradle version to gradle-4.8-all.zip in the following file in disributionUrl: 我将gradle版本更新为disributionUrl中以下文件中的gradle-4.8-all.zip:

[your-react-native-project]/android/gradle/wrapper/gradle-wrapper.properties [您反应的本地项目] /android/gradle/wrapper/gradle-wrapper.properties

It solved the issue. 它解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM