I am at my wits end trying to get this to work, and I'm not finding a solution. I just upgraded my Android Studio to Arctic Fox and I'm getting this error:
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.
I am running on macOS BiGSur 11.2.3.
I opened terminal and ran /usr/libexec/java_home -V | grep jdk
Which outputs:
Matching Java Virtual Machines (1):
1.8.301.09 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
I tried editing ~/.zshrc by adding various export lines such as:
export JAVA_HOME=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
to which I get this error in the terminal after running source ~/.zscrc:
.zshrc:export:2: not valid in this context: Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
and tried this:
export JAVA_HOME=$(/usr/libexec/java_home)
which just repeats the same Build failure.
I also tried adding various paths to the Gradle.properties file, such as one of the following:
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
Same Build failure for the first one, and 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) for the second one.
I did a search for tools.jar on my system, and nothing is found.
Also tried uninstalling Java and reinstalling it... nothing.
Please any other suggestions?