修复错误:为 org.gradle.java.home Gradle 属性'/Library/Java/JavaVirtualMachines/jdk1.8.0_281.jdk/Contents/H



每当我试图运行我的react native应用程序与这个命令react-native run-android得到这个错误:

FAILURE: Build failed with an exception.
* What went wrong:
Value '/Library/Java/JavaVirtualMachines/jdk1.8.0_281.jdk/Contents/Home' given for org.gradle.java.home Gradle property is invalid (Java home supplied is invalid)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan 
to get full insights.
* Get more help at https://help.gradle.org
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

环境变量中的My Paths正确,如下所示:

系统变量-JAVA_HOME - C:Program FilesJava jdk1.8.0_281bin

我甚至试图将/android/gradle.properties中的一行更改为-

  1. org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home
  2. org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_281.jdk/Contents/Home
  3. org.gradle.java.home=C:Program FilesJavajdk1.8.0_281

但以上都不工作

在android Studio中打开android文件夹,得到相同的错误-值'/Library/Java/JavaVirtualMachines/jdk1.8.0_281.jdk/Contents/Home' given for org.gradle.java.home Gradle property is invalid (Java home supplied is invalid)

请帮帮我

在gradle.properties中注释上述行macOS下为JDK路径,不支持Windows。

相关内容

  • 没有找到相关文章

最新更新