简体   繁体   English

Cordova CLI无法检测到JDK

[英]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. 我的jdk版本是9.0.1,绝对大于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 我在Internet上看到以下建议:1)卸载较旧的JDK版本-但我没有较旧的版本2)更新一些环境变量-均无济于事

I'm running Windows 10 (64-bit). 我正在运行Windows 10(64位)。

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. 1)根据Android SDK的位置配置ANDROID_HOME环境变量。
2) Add ANDROID_HOME/tools, and ANDROID_HOME/platform-tools to your PATH. 2)将ANDROID_HOME / tools和ANDROID_HOME / platform-tools添加到PATH。

Configuring ANDROID_HOME haven't worked for me. 配置ANDROID_HOME不适用于我。

The solution for my problem was given by Bilash in this link : Bilash在此链接中给出了我的问题的解决方案:
Uninstall JDK 9 and install JDK 8. 卸载JDK 9并安装JDK 8。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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