androidcordovaionic-frameworkionic3macos-big-sur

Ionic + Cordova Android build error - could not find tools.jar


today I've upgrade my MacBook to macOS Big Sur version 11.0.1. Now there is a problem coming out when I tried to build the project for Android.

Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.

Solution

  • 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.