Flutter could not find tools.jar

Hi today I've upgrade my MacBook to macOS Big Sur version 11.0.1. Now there is a problem coming out.

* What went wrong:
Execution failed for task ':apple_sign_in:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.

Anyone know how to solve this issue ? Thanks.


Solution 1:

THREAD CLOSED

I'm a Mac user. I've found the solution by using this method.

  1. Go to your android folder > Gradle.properties > add your jdk path.
// Example 
org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home
  1. Clean and rebuild then it's done.

Solution 2:

Possible duplicate of https://stackoverflow.com/a/64864365/2405040.

You should not alter gradle.properties manually. Try setting your JAVA_HOME in ~/.bash_profile to something like-

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home

then relaunch a terminal session or run

source ~/.bash_profile

If you are using Zsh/Oh-My-Zsh, add the above with file ~/.zshrc and then reload the same or relaunch the terminal-

source ~/.zshrc