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-

  1. Flutter could not find tools.jar
  2. 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.


Try running

/usr/libexec/java_home -V

And see if this shows in the list

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

This was the case for me and I had to remove the entries to the Internet Plug-Ins folder. Check here for more details that helped me.