【发布时间】:2021-10-07 07:10:36
【问题描述】:
我想尽办法让它发挥作用,但我没有找到解决方案。我刚刚将我的 Android Studio 升级到了北极狐,我收到了这个错误:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':firebase_core:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
我在 macOS BiGSur 11.2.3 上运行。
我打开终端并运行/usr/libexec/java_home -V | grep jdk
哪些输出:
Matching Java Virtual Machines (1):
1.8.301.09 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
我尝试通过添加各种导出行来编辑~/.zshrc,例如:
export JAVA_HOME=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
运行source ~/.zscrc 后我在终端中收到此错误:
.zshrc:export:2: not valid in this context: Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
并尝试过:
export JAVA_HOME=$(/usr/libexec/java_home)
这只是重复相同的构建失败。
我还尝试向 Gradle.properties 文件添加各种路径,例如以下路径之一:
org.gradle.java.home=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home
第一个构建失败,第二个构建失败 Value '/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home' given for org.gradle.java.home Gradle property is invalid (Java home supplied is invalid)。
我在我的系统上搜索了 tools.jar,但没有找到。
还尝试卸载 Java 并重新安装它...没有。
还有其他建议吗?
【问题讨论】:
标签: java android macos gradle build