Flutter could not find tools.jar

Solution of u problem -> Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation

At last, here I found the solution.

I added jdk path


to gradle.properties file and did a rebuild.

It works now.

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

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


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 
  1. Clean and rebuild then it's done.