gpt4 book ai didi

android - Cordova ubuntu : An error occurred while listing Android targets

转载 作者:IT老高 更新时间:2023-10-28 23:12:00 25 4
gpt4 key购买 nike

我正在尝试将 android 平台添加到我的 cordova 项目中,但出现错误:

$ cordova platform add android -d
cordova library for "android" already exists. No need to download. Continuing.
Checking if platform "android" passes minimum requirements...
Checking Android requirements...
cordova library for "android" already exists. No need to download. Continuing.
Error: An error occurred while listing Android targets
at /home/jasonshark/.cordova/lib/android/cordova/3.2.0/bin/lib/check_reqs.js:83:29
at _rejected (/home/jasonshark/.cordova/lib/android/cordova/3.2.0/bin/node_modules/q/q.js:808:24)
at /home/jasonshark/.cordova/lib/android/cordova/3.2.0/bin/node_modules/q/q.js:834:30
at Promise.when (/home/jasonshark/.cordova/lib/android/cordova/3.2.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/home/jasonshark/.cordova/lib/android/cordova/3.2.0/bin/node_modules/q/q.js:752:41)
at /home/jasonshark/.cordova/lib/android/cordova/3.2.0/bin/node_modules/q/q.js:574:44
at flush (/home/jasonshark/.cordova/lib/android/cordova/3.2.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)

没有 -d 它将是:

Checking Android requirements...
[Error: An error occurred while listing Android targets]

我不确定我缺少什么配置。在我的 ~/.bashrc 文件中,我有:

### Java
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386

export ANDROID_HOME=~/Code/adt-bundle-linux-x86-20131030/sdk/tools
export ANDROID_PLATFORM_TOOLS=~/Code/adt-bundle-linux-x86-20131030/sdk/platform-tools
export PATH=$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$PATH

我已经安装了 ant:

$ ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011

缺少什么?为什么我在尝试将 android 平台添加到 cordova 项目时收到错误 An error occurred while Listing Android targets

最佳答案

Cordova 有一个脚本来检查是否存在所有依赖项。当您运行 cordova platform add android 时会调用它,但不幸的是它的输出在失败时不会显示。

你可以尝试手动运行,应该是$home/.cordova/lib/android/cordova/3.5.0/bin/check_reqs

一切正常时的正常输出是“看起来你的环境完全支持cordova-android开发!”,否则它应该显示一个关于缺少什么的明确消息。

也许你的问题是你没有在android sdk manager中安装API 19的SDK平台(cordova 3.3或3.5使用目标sdk 19)

更新: Cordova 3.3 或 3.5 仅适用于 SDK 19 (Android 4.4.2)。错误日志没有明确提到它正在寻找什么平台版本。通常的错误消息是:

Unable to add platform android. Please see console for more info.

[Error: An error occurred while listing Android targets]

android (sdk/tools) 不在路径中时,也会发生这种情况。如果检查脚本打印了正确的错误消息,我会喜欢的。顺便说一句,created a PR for them .

关于android - Cordova ubuntu : An error occurred while listing Android targets,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21699585/

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