I went ahead and downloaded Java from: https://www.java.com/en/download/
(There was another download page, but it required an Oracle login.)
After installing, I then got the error (when building):
Could not find tools.jar.
Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
Research Reference:
https://stackoverflow.com/questions/64968851/could-not-find-tools-jar-please-check-that-library-internet-plug-ins-javaapple
The top two suggestions at this SO didn't help (and when using the path mentioned farther below, the emulator wouldn't start and gave a Mac alert error). They both suggested the following:
> /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
> vim .zshrc
add the following:
export JAVA_HOME=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
This seems to work for most others. But a 1-vote answer (now 2) had a solution that worked for my situation. There were a few other answers that referenced this fix, but this answer was the clearest.
Go to your project, open android folder > gradle.properties file > add the below line
org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home
Caveat:
Double checking this solution, I opened Applications, right-clicked on Android Studio.app, selected Show Package Contents, then navigated to /Contents/jre, but there was no jdk.
So I just removed the /jdk from the path.
[/Users/[username]/Documents/src/projects/[projectname]/android/gradle.properties]
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/Contents/Home
# org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home
Although likely something I did, still no clue what might've changed from last week, and I'll just need to check/add this for each project.
- Keith