我正在尝试使用命令 cordova platform add android
将平台 android
添加到 Cordova 项目中,但它给出了以下错误信息 -
Creating android project...
D:\Users\admin\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at D:\Users\admin\.cordova\lib\android\cordova\3.5.0\bin\lib\check_reqs.js:87:29
at _rejected (D:\Users\admin\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:808:24)
at D:\Users\admin\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:834:30
at Promise.when (D:\Users\admin\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:1079:31)
at Promise.promise.promiseDispatch (D:\Users\admin\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:752:41)
at D:\Users\admin\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:574:44
at flush (D:\Users\admin\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:415:13)
Error: D:\Users\admin\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Command failed with exit code 8
at ChildProcess.whenDone (D:\Users\admin\Application Data\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
我已经在谷歌上搜索过,并找到了其他答案,尝试了所有与设置路径相关的内容。
1)安装了ANT,Java和Android SDK 2)在环境变量中为and、java和android sdk工具及平台工具设置路径 3)多次重新启动计算机。
当我运行java -version和ant -version时,我得到:
D:\Users\admin>java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)
D:\Users\admin>ant -version
Apache Ant(TM) version 1.9.4 compiled on April 29 2014
我仍然遇到这个错误。 任何帮助都将是非常棒的。(我使用的是32位Windows XP操作系统)