我尝试在phonegapHello中添加android平台时遇到问题。我试图在phonegap中添加android平台时遇到问题。我在我的my-app文件夹中运行命令'android platform add android'但是出现了这个错误。
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\user>npm install -g cordova
C:\Users\user\AppData\Roaming\npm\cordova -> C:\Users\user\AppData\Roaming\npm\n
ode_modules\cordova\bin\cordova
cordova@4.1.2 C:\Users\user\AppData\Roaming\npm\node_modules\cordova
├── q@1.0.1
├── underscore@1.7.0
├── nopt@3.0.1 (abbrev@1.0.5)
└── cordova-lib@4.1.2 (osenv@0.1.0, properties-parser@0.2.3, mime@1.2.11, semver
@2.0.11, unorm@1.3.3, bplist-parser@0.0.6, dep-graph@1.1.0, shelljs@0.3.0, eleme
nttree@0.1.5, rc@0.5.2, d8@0.4.4, xcode@0.6.7, npmconf@0.1.16, tar@1.0.2, npm@1.
3.4, glob@4.0.6, plist@1.1.0, request@2.47.0, cordova-js@3.7.2)
C:\Users\user>cd C:\android apps
C:\Android Apps>cd my-app
C:\Android Apps\my-app>phonegap run android
[phonegap] executing 'cordova platform add android'...
Creating android project...
C:\Users\user\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\node_modu
les\q\q.js:126
throw e;
^
Error: Failed to run "java -version", make sure your java environment is set up
including JDK and JRE.
Your JAVA_HOME variable is: C:\Program Files\Java\jdk1.7.0_67
at C:\Users\user\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\li
b\check_reqs.js:43:27
at ChildProcess.exithandler (child_process.js:652:7)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Socket.<anonymous> (child_process.js:969:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
Error: C:\Users\user\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\cr
eate.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\user\AppData\Roaming\npm\node_modules\pho
negap\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:13
5:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
[phonegap] executing 'cordova run android'...
No platforms added to this project. Please use `cordova platform add <platform>`
.
C:\Android Apps\my-app>cordova platform add android
Creating android project...
C:\Users\user\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\node_modu
les\q\q.js:126
throw e;
^
Error: Failed to run "java -version", make sure your java environment is set up
including JDK and JRE.
Your JAVA_HOME variable is: C:\Program Files\Java\jdk1.7.0_67
at C:\Users\user\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\li
b\check_reqs.js:43:27
at ChildProcess.exithandler (child_process.js:652:7)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Socket.<anonymous> (child_process.js:969:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
Error: C:\Users\user\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\cr
eate.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\user\AppData\Roaming\npm\node_modules\cor
dova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
C:\Android Apps\my-app>