我试图使用
将android平台添加到我的cordova项目中cordova platform add android
但是,我收到以下错误:
Error: Please install Android target 19 (the Android newest SDK). Make sure you have the
latest Android tools installed as well. Run "android" from your command-line to
install/update any missing SDKs or tools.
如消息所示,我使用android命令安装所有更新。除此之外,我还在路径变量中添加了以下内容:
%ANT_HOME%\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%JAVA_HOME%\bin
我在网上找到的类似问题的其他回复建议将 project.properties 文件中的目标变量设置为
target=android-19
我在过去几天尝试了所有这些,但我无法解决此错误。我还能尝试解决这个问题吗?顺便说一句,我正在运行Windows 8.1 64位。
编辑:
我想在运行
时添加更多信息android list target
我得到以下输出
Available Android targets
id: 1 or "android-19"
Name: Android 4.4.2
Type: Platform
API level: 19
Revision: 3
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : default/armeabi-v7a, default/x86
id: 2 or "Google Inc.:Google APIs x86:19"
Name: Google APIs x86
Type: Add-On
Vendor: Google Inc.
Revision: 4
Description: Android + Google APIs x86
Based on Android 4.4.2 (API level 19)
Libraries:
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: WVGA800 (default), WVGA854, WSVGA, WXGA720, HVGA, WXGA800-7in, QVGA, WQVGA400, WQVGA432, WXGA800
Tag/ABIs : default/x86
id: 3 or "Google Inc.:Google APIs:19"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 4
Description: Android + Google APIs
Based on Android 4.4.2 (API level 19)
Libraries:
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: WVGA800 (default), WVGA854, WSVGA, WXGA720, HVGA, WXGA800-7in, QVGA, WQVGA400, WQVGA432, WXGA800
Tag/ABIs : default/armeabi-v7a
答案 0 :(得分:2)
我遇到了同样的问题。我通过下载相应的来源以及目标[Android L,Android 4.4W(API 20)和Android 4.4.2w(API 19)]来解决它。
android list target
输出:
Available Android targets:
----------
id: 1 or "android-19"
Name: Android 4.4.2
Type: Platform
API level: 19
Revision: 3
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : default/armeabi-v7a, default/x86
----------
id: 2 or "android-20"
Name: Android 4.4W
Type: Platform
API level: 20
Revision: 1
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearSquare, AndroidWearRound, AndroidWearSquare
Tag/ABIs : android-wear/armeabi-v7a, android-wear/x86
----------
id: 3 or "android-L"
Name: Android L (Preview)
Type: Platform
API level: L
Revision: 3
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, default/armeabi-v7a, default/x86
----------
id: 4 or "Google Inc.:Glass Development Kit Preview:19"
Name: Glass Development Kit Preview
Type: Add-On
Vendor: Google Inc.
Revision: 8
Description: Preview of the Glass Development Kit
Based on Android 4.4.2 (API level 19)
Libraries:
* com.google.android.glass (gdk.jar)
APIs for Glass Development Kit Preview
Skins: WXGA800, WXGA800-7in, HVGA, WVGA800 (default), WQVGA400, QVGA, WSVGA, WQVGA432, WXGA720, WVGA854
Tag/ABIs : no ABIs.
----------
id: 5 or "Google Inc.:Google APIs:19"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 6
Description: Android + Google APIs
Based on Android 4.4.2 (API level 19)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: WXGA800, WXGA800-7in, HVGA, WVGA800 (default), WQVGA400, QVGA, WSVGA, WQVGA432, WXGA720, WVGA854
Tag/ABIs : default/armeabi-v7a
----------
id: 6 or "Google Inc.:Google APIs (x86 System Image):19"
Name: Google APIs (x86 System Image)
Type: Add-On
Vendor: Google Inc.
Revision: 6
Description: Android x86 + Google APIs
Based on Android 4.4.2 (API level 19)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: WXGA800, WXGA800-7in, HVGA, WVGA800 (default), WQVGA400, QVGA, WSVGA, WQVGA432, WXGA720, WVGA854
Tag/ABIs : default/x86
答案 1 :(得分:1)
我和你有同样的问题,这个错误让我发疯了。
当我将调用移至android
,ant
和java
变量路径到系统变量路径时,不是它工作的用户变量路径。希望你也能这样。
答案 2 :(得分:1)
我遇到了同样的错误:请安装Android目标19
*原因* 环境变量路径未定义/不正确/缺少某些字符
*解决方案* 视窗: 将platform-tools \目录添加到Windows路径:;
MAC:更新PATH变量以指向/etc/rc.common文件中的Android SDK Platform-tools目录或〜/ .bash_profile:
PATH = / bin中:/ sbin目录:在/ usr / bin中:/ usr / sbin目录:在/ usr /的libexec:/系统/库/ CoreServices:/开发人员的/ usr / bin中:〜/开发/ Android设备/机器人-sdk- macosx / tools:〜/ Development / Android / android-sdk-macosx / platform-tools:export PATH
LINUX:更新您的PATH以指向Android SDK Platform-tools目录。如果使用bash shell,请将以下内容添加到〜/ .bashrc:
export PATH = / opt / android-sdk-linux / tools /:/ opt / android-sdk-linux / platform-tools /:$ PATH
答案 3 :(得分:1)
我遵循了Bhavin的答案,这可能有所帮助,但在我做两件事之前我无法解决这个问题:
运行android.bat并安装此人:
在%ANDROID_HOME%\ tools \ lib \中打开find_java.bat并更改此行:
for / f" delims =" %% a in('"%~dps0 \ find_java.exe" -s')设置java_exe = %% a
到此:
set java_exe=%JAVA_HOME%\java.exe
寻找系统/环境变量的细微差别开始让我的眼睛交叉。当我看到 android.bat 调用 find_java.bat 时,我修改了 find_java 来回显java路径。它在我的 System32 目录中找到了 java.exe 。 java.exe 没有运行,但由于它在那里,android会尝试使用它。
答案 4 :(得分:0)
对于Windows,在环境变量中尝试将java \ bin目录放在windows \ system32目录之前。
这使得SDK Manager从java \ bin目录使用java,否则它将使用在system32文件夹中找到的java。
这应该有帮助!
答案 5 :(得分:0)
我的解决方案是添加除了19.1之外的Android SDK Build-tools 19!