简体   繁体   中英

Cordova cli doesn't detect JDK

When I run the following command:

ionic cordova build android --prod --release

I get an error:

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

[ERROR] An error occurred while running cordova build android --release (exit code 1).

Why does it fail? My jdk version is 9.0.1, which is definitely greater than 1.8.

I saw the following suggestions on the Internet: 1) Uninstall older JDK versions - but I don't have an older version 2) Update some environment variables - didn't help either

I'm running Windows 10 (64-bit).

Ideas?

Someone posted an answer here, I tested it, and it worked. When I returned in order to accept it, the answer turned out to be deleted for some reason.

Anyway, the answer is:

1) Configure the ANDROID_HOME environment variable based on the location of the Android SDK.
2) Add ANDROID_HOME/tools, and ANDROID_HOME/platform-tools to your PATH.

Configuring ANDROID_HOME haven't worked for me.

The solution for my problem was given by Bilash in this link :
Uninstall JDK 9 and install JDK 8.

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