Cordova添加平台:无法安装'cordova-plugin-whitelist'CordovaError:JDK 1.8或更高版本的要求检查失败

时间:2017-02-01 10:01:16

标签: cordova

cordova platform add android

Subproject Path: CordovaLib
Android project created with cordova-android@6.0.0
Installing "cordova-plugin-whitelist" for android
ANDROID_HOME=C:\Users\Proxymis\AppData\Local\Android\sdk1
JAVA_HOME=C:\Program Files\Java\jre1.8.0_121
Failed to install 'cordova-plugin-whitelist':CordovaError: Requirements check failed for JDK 1.8 or greater
    at C:\Users\Proxymis\Desktop\sendSMS\platforms\android\cordova\lib\check_reqs.js:278:19
    at _fulfilled (C:\Users\Proxymis\Desktop\sendSMS\platforms\android\cordova\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (C:\Users\Proxymis\Desktop\sendSMS\platforms\android\cordova\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (C:\Users\Proxymis\Desktop\sendSMS\platforms\android\cordova\node_modules\q\q.js:796:13)
    at C:\Users\Proxymis\Desktop\sendSMS\platforms\android\cordova\node_modules\q\q.js:604:44
    at runSingle (C:\Users\Proxymis\Desktop\sendSMS\platforms\android\cordova\node_modules\q\q.js:137:13)
    at flush (C:\Users\Proxymis\Desktop\sendSMS\platforms\android\cordova\node_modules\q\q.js:125:13)
    at _combinedTickCallback (node.js:370:9)
    at process._tickCallback (node.js:401:11)
Error: Requirements check failed for JDK 1.8 or greater

我认为我的环境还可以:

JAVA_HOME
C:\Program Files\Java\jdk1.8.0_121

java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

1 个答案:

答案 0 :(得分:2)

您应该将 JAVA_HOME 环境变量设置为JDK根文件夹而不是JRE文件夹,如下所示。

更正JAVA_HOME后,请执行

cordova requirements android

验证您已满足cordova android平台的环境要求。

enter image description here