gpt4 book ai didi

android - 列出 Android 目标时出错

转载 作者:技术小花猫 更新时间:2023-10-29 10:17:54 25 4
gpt4 key购买 nike

我在尝试将 add platform Android 添加到在 Windows 8 上使用 CLI Cordova 创建的简单 HelloWorld 应用程序时遇到了同样的错误。

已设置路径变量%ANT%,%ANT_HOME%,%ANDROID_HOME%
PATH 还包含%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 上创建相同的错误时也会出现类似的错误。

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_HOME% 作为变量并将其缩放到路径变量 %ANDROID_HOME%\SDK\TOOLS。这种方法不起作用。通过直接指向工具和平台工具实验解决。

最佳答案

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

"Your ability to run these commands depends on whether your machine supports each SDK, and whether you have already installed each SDK."

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


不过 Android 很奇怪。您能提供更多详细信息吗? (环境变量都设置对了吗?你加JAVA_HOME了吗?..)

希望我能提供更多信息以提供更多帮助:)

关于android - 列出 Android 目标时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23466479/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com