I have seen so many queries on this. But none of these are able to resolve my issue. I am trying to build a Cordova Android app. But the cordova requirements are always failing as it is unable to find JAVA_HOME. The error I am getting is below
C:\Android-Dev\WorkSpace\myTFS>cordova requirements
Android Studio project detected
Requirements check results for android:
**Java JDK: not installed
Failed to run "javac -version", make sure that you have a JDK installed.
You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.
Your JAVA_HOME is invalid: C:\Program Files\Java\jdk1.8.0_171**
Android SDK: installed true
Android target: not installed
cmd: Command failed with exit code ENOENT
Gradle: not installed
Cannot read property 'toString' of null
(node:4220) UnhandledPromiseRejectionWarning: CordovaError: Some of requirements check failed
at C:\Users\SAHAA2\AppData\Roaming\npm\node_modules\cordova\src\cli.js:414:27
at _fulfilled (C:\Users\SAHAA2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:787:54)
at C:\Users\SAHAA2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:816:30
at Promise.promise.promiseDispatch (C:\Users\SAHAA2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:749:13)
at C:\Users\SAHAA2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:557:44
at flush (C:\Users\SAHAA2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:108:17)
at process._tickCallback (internal/process/next_tick.js:61:11)
at Function.Module.runMain (internal/modules/cjs/loader.js:746:11)
at startup (internal/bootstrap/node.js:240:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:564:3)
(node:4220) 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:4220) [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.
Below is my JAVA home and path variable settings. I know a lot of people have asked to provide path to bin folder in PATH variable. But its still not working. Below is my system varible
C:\Android-Dev\WorkSpace\myTFS>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_171
C:\Android-Dev\WorkSpace\myTFS>echo %path%
C:\Program Files\Java\jdk1.8.0_171\bin;C:\Program Files\nodejs\;C:\Android-Dev\SDK\platform-tools;C:\Android-Dev\SDK\tools;C:\Program Files\Android\Android Studio\gradle\gradle-4.4\bin;C:\User
s\SAHAA2\AppData\Roaming\npm
Is this related to access issue as it says Failed to run "javac -version", make sure that you have a JDK installed.
Any help will be really appreciated. I would have refrained from raising the question again as so many have asked before but nothing seems to work for me. Hence putting the same question again. Anyone needing any more details please let me know
This might be because of space in JAVA_HOME path. Replace C:\\Program Files\\Java\\jdk1. 8.0_171
C:\\Program Files\\Java\\jdk1. 8.0_171
with C:\\Progra~1\\Java\\jdk1. 8.0_171
C:\\Progra~1\\Java\\jdk1. 8.0_171
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.