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
~/.bash_profile to something like-
then relaunch a terminal session or run
If you are using Zsh/Oh-My-Zsh, add the above with file
~/.zshrc and then reload the same or relaunch the terminal-
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.
- 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
- Clean and rebuild then it's done.