Could not find tools.jar
Looks like it's looking for a JDK while you're pointing to a JRE. Do you have an installed JDK? If so, maybe try pointing to that.
Flutter could not find tools.jar
THREAD CLOSED
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.
Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation
The problem is that with the update the built-in java took precedence and it doesn't have the SDK because it's just the runtime.
You just need to change your java home and add the java binary to your .zshrc
to find your java home execute:
/usr/libexec/java_home -V | grep jdk
the output should be similar to the following:
Matching Java Virtual Machines (1):
1.8.0_272 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
you should take the path from the one that says SDK in my case
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
after that, you just add the following to the end of your .zshrc that should be in your home.
You can edit it with (if you decide to use vim you can exit writing :wq! and pressing enter)
vim .zshrc
add the following:
export JAVA_HOME=the/path/you/copied/before
export PATH=$JAVA_HOME/bin:$PATH
where the/path/you/copied/before in my case would be
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
save the file and close all your terminals and open them again.
If while editing .zshrc file getting error ".zshrc" E212: Can't open file for writing
then use sudo vim.zshrc and you'll be able to edit.
The error should be solved.
Edit
Instead of ~/.zshrc
, you could have ~/.bash_profile
or ~/.bash_rc
so edit yours accordingly
Ionic + Cordova Android build error - could not find tools.jar
I also faced the same issue today while the same setup (building the Android app) was working for me before upgrading to Big Sur.
I saw various solutions like-
- Flutter could not find tools.jar
- Not able to run Eclipse on macOS Big Sur
But I was not sure if those were recommended solution. I tried for few hours and finally got it working with the correct fix (looks to me).
Basically, for me, the JAVA_HOME
variable was not set (or Big Sur removed it somehow).
So I simply added it in my ~/.zshrc
(or ~/.bashrc
)-
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
You can simply check and replace the version number in the above line.
Related Topics
Calculating the Angle Between a Line and the X-Axis
Polyline Is Not on the Roads: It Goes Straight from One Point to Other
Automatically Log Android Lifecycle Events Using Activitylifecyclecallbacks
How to Draw an Arrowhead (In Android)
Firebase Database Points to Wrong Database Url
How to Programmatically Add Views and Constraints to a Constraintlayout
How to Create Button Dynamically in Android
Android Java.Net.Unknownhostexception: Host Is Unresolved (Strategy Question)
Simple Program to Call R from Java Using Eclipse and Rserve
Aes Cbc Pkcs5Padding Java to Ruby
Runtime.Exec():Reboot in Android
Android: Google Maps API - Change Position of Maps Toolbar
Eclipse: Jvm Terminated. Exit Code=2
Android: Cannot Perform This Operation Because the Connection Pool Has Been Closed