列出Android目标时发生错误

时间:2014-05-05 06:49:10

标签: android ios cordova ant

尝试add platform Android在Windows 8上使用CLI Cordova创建的简单HelloWorld应用程序时出现同样的错误。

路径vaiables已设置为 的%ANT%,%ANT_HOME%,%ANDROID_HOME%
路径还包含 列表中的%ANDROID_HOME%\ platform-tools %ANDROID_HOME%\ tools

PS E:\Android Projects\HelloWorld> cordova platforms add android
Creating android project...

C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:126
                throw e;
                      ^
Error: An error occurred while listing Android targets
    at C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\lib\check_reqs.js:87:29
    at _rejected       (C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:808:24)
at C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:834:30
at Promise.when (C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:1079:31)
at Promise.promise.promiseDispatch (C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:752:41)
at C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:574:44
at flush (C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:415:13)
Error: C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\create.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\MIGHTY\AppData\Roaming\npm\node_modules\cordova\src\superspawn.js:126: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)

在尝试在iOS上创建相同的Simillar时也会出现错误。

PS E:\Android Projects\HelloWorld> cordova platforms add ios
Creating ios project...
Error: C:\Users\MIGHTY\.cordova\lib\ios\cordova\3.4.1\bin\create: Command failed with       exit code ENOENT
at ChildProcess.whenDone (C:\Users\MIGHTY\AppData\Roaming\npm\node_modules\cordova\src\superspawn.js:126:23)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:795:12)

解决:

谢谢你,the issue with Android has been resolved

指向这个android的路径变量是错误的。我使用了%ANDROID_HOME%作为变量,并将其扩展为路径变量%ANDROID_HOME%\ SDK \ TOOLS 。这种方法不起作用。通过直接指向工具和平台工具进行实验解决。

1 个答案:

答案 0 :(得分:3)

您无法在Windows 8上添加iOs平台(请检查链接上的可用命令):

  

"您运行这些命令的能力取决于您的计算机是否支持每个SDK,以及您是否已安装每个SDK。"

  来源:http://cordova.apache.org/docs/en/3.4.0//guide_cli_index.md.html#The%20Command-Line%20Interface


虽然Android很奇怪..你能提供更多细节吗? (所有环境变量都设置正确吗?你添加了JAVA_HOME吗?..)

希望我能更多地获得更多信息:)