Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter could not find tools.jar

Tags:

macos

flutter

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.

like image 753
YeN Avatar asked Nov 13 '20 12:11

YeN


People also ask

Could not find tools jar in JRE?

I had the same problem and fixed it like this: Install the JDK from the Oracle website with the same version number as the JRE if you didn't already. Furthermore add JAVA_HOME to the environment variables of Windows. Restart your terminal or development environment to load the new JAVA_HOME value.


3 Answers

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.
like image 162
YeN Avatar answered Oct 11 '22 03:10

YeN


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
like image 28
Shashank Agrawal Avatar answered Oct 11 '22 03:10

Shashank Agrawal


I can't comment, but here's a macOS one-liner based on the other answers if you use ZSH (Catalina+ default). No need to install Java from Oracle.

echo 'export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"' >> ~/.zshrc && source ~/.zshrc
like image 5
hot_gril Avatar answered Oct 11 '22 04:10

hot_gril