我已经为此停留了几个小时:
C:\Users\emper\CORDOVABE>cordova build android
Android Studio project detected
ANDROID_HOME=C:\Users\emper\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk-9.0.4
(node:9072) UnhandledPromiseRejectionWarning: CordovaError: Requirements check failed for JDK 1.8 or greater
at C:\Users\emper\CORDOVABE\platforms\android\cordova\lib\check_reqs.js:370:19
at _fulfilled (C:\Users\emper\CORDOVABE\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\Users\emper\CORDOVABE\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\Users\emper\CORDOVABE\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\Users\emper\CORDOVABE\platforms\android\cordova\node_modules\q\q.js:624:44
at runSingle (C:\Users\emper\CORDOVABE\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (C:\Users\emper\CORDOVABE\platforms\android\cordova\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
(node:9072) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9072) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
显然,问题是JAVA_HOME应该指向一个较低的JDK,我安装了1.8,但无法获取JAVA_HOME指向它。我添加了Env变量(系统),以指向正确的jdk位置,没有运气。由于某些解决方案推荐,我尝试了一点更改Path的方法,但还是没有运气。尝试更改Android Stuido中的jdk位置(取消选中嵌入式jdk位置并选择一个自定义的jdk位置),还是没有。一些帮助 ?谢谢!