Java – Cordova build android JDK 1.8 check failed

Cordova build android > JDK 1.8 check failed… here is a solution to the problem.

Cordova build android > JDK 1.8 check failed

I’m following this tutorial About building the Cordova app. I got to the part where I was supposed to build, in PowerShell (I’m on Windows 10) I typed cordova build android and I got this error repeatedly :

ANDROID_HOME=C:\Android
JAVA_HOME=C:\Program Files\java\jdk-9.0.1
Error: Requirements check failed for JDK 1.8 or greater

I realize this question has been asked here before, but these answers don’t seem to apply to me.

Something I’ve tried :

  • Uninstall and reinstall JDK 9
  • Install JDK

  • 8 with JDK 9 installed

Solution

As the message says, Android tools require JDK 8, not JDK9.

If both JDK8 and JDK9 are installed, you must check the version in the path and where JAVA_HOME points.

In the log you posted, I see that JAVA_HOME points to JDK9.

You can modify your globel JAVA_HOME env var to target JDK8, or if you only want to use jdk8 with cordova, you can change the JAVA_HOME::in PowerShell before using the cordova CLI

$env:JAVA_HOME="C:\Program Files\Java\jdk1.8.0_151"
cordova build android

Related Problems and Solutions