/gradlew在React Native 0.68中失败(Android Gradle插件需要Java 11才能运行.



更新到React Native 0.68后,我在执行时遇到了这个错误/gradlew:

FAILURE: Build failed with an exception.
* Where:
Build file '/Users/username/path/projectname/android/app/build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.

在MacOS上,您只需要安装React Native 推荐的Java开发工具包

brew tap homebrew/cask-versions
brew install --cask zulu11

我想你需要在Windows上做choco install -y nodejs-lts openjdk11,我还没有测试过。

来源:https://reactnative.dev/docs/environment-setup#installing-依赖项

最新更新