简体   繁体   中英

cordova build android > check failed for JDK 1.8

I am following this tutorial on building a Cordova application. I get to the part that where I'm supposed to build, and in powershell (I'm on Windows 10) I type cordova build android and I repeatedly get this error:

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 those answers do not seem to apply to me.

Things I've tried:

  • Uninstalling and reinstalling JDK 9
  • Installing JDK 8 with JDK 9 installed

As the messages says the android tools require jdk 8, not jdk9.

If you have both jdk8 and jdk9 installed, you have to check wich version is in the path and where JAVA_HOME is pointing to.

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

You can either modify your globel JAVA_HOME env var to target JDK8 or you can change JAVA_HOME in powershell before you use the cordova CLI if you want to use jdk8 only for cordova:

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

"! My problem was i have JDK declared at many variables. Check where declared JDK!!

Sorry for my english.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM