请安装Android目标:"android-21" [英] Please install Android target: "android-21"

查看:372
本文介绍了请安装Android目标:"android-21"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了最新的cordova.版本是4.3.0.我创建了一个空的Cordova项目:

I have installed the latest cordova. The version is 4.3.0. I created an empty Cordova project:

cordova create test com.test Test

然后我添加平台:

cordova platform add android

我用以下项目构建了项目:

I built the project with:

cordova build android

但是我总是得到:

[Error: Please install Android target: "android-21".

Hint: Open the SDK manager by running: C:\Program\ Files\     (x86)\Android\android-studio\sdk\tools\android.BAT
You will require:
1. "SDK Platform" for android-21
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)]

因此我运行"android"以确认我已安装了最新的SDK:

So i ran "android" to confirm I have latest SDK installed:

然后我尝试将目标android sdk更改为19,因此在AndroidManifest.xml中,我进行了更改:

I then tried changing the target android sdk to be 19 so in AndroidManifest.xml I changed:

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="21" />

收件人:

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />

我再次运行了构建命令,但仍然收到完全相同的错误.这让我发疯.有人有想法么?我已经在同一台PC上构建了许多Cordova项目,但以前从未见过此问题.

I ran the build command again, and I still get the exact same error. This is driving me nuts. Anyone have any ideas? I've built many many cordova projects on this same PC and have never seen this problem before.

推荐答案

我遇到了同样的问题-如果您仅下载Android SDK但尚未启动android命令并安装更新,则会发生此问题.在这种情况下,Cordova会告诉您为Android API版本23(在您的platforms/android/project.properties文件中指定为"android-23")安装/更新SDK.

I had the same problem - it occurs if you only download the Android SDK but have not yet started the android command and installed updates. In this case Cordova is telling you to install/update the SDK for Android's API version 23 (specified as "android-23" in your platforms/android/project.properties file).

解决方案:运行android [*]并选择相应的:

Solution: run android[*] and select the corresponding:

  • 在工具下:
    • "Android SDK平台工具23.1
    • "Android SDK Build-tools 23.1
    • Under Tools:
      • "Android SDK Platform-tools 23.1
      • "Android SDK Build-tools 23.1
      • SDK平台

      安装这些文件并重新运行cordova build android,它应该可以工作.

      Install these and re-run cordova build android and it should work.

      [*]假设您的sdk/tools路径在系统PATH上(请参见此处)

      [*] Assuming your sdk/tools path is on your system PATH (see here)

      这篇关于请安装Android目标:"android-21"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆