Cordova : [Error: Please install Android target: “android-21”

南楼画角 提交于 2019-11-27 17:35:40

I just had the same problem. I had to change the target:

# Project target.
target=android-22

This should be done in two files:

myApp/platforms/android/project.properties myApp/platforms/android/CordovaLib/project.properties

Also the manifest should be updated:

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" />
Shamsher

Follow these steps.
1) Type android on command line.(Make sure ANDROID_HOME and PATH are set properly)
2) Select API 21 from the populated list.
3) Click install packages.
4) Type android avd on command line.
5) Set API level and other config.
6) Now type ionic build android.

many times the problem is that not is configurated the path environment variable ANDRIOD_HOME. Take a look

%ANDROID_HOME% = C:\Program Files (x86)\Android\android-sdk
In Path:
%ANDROID_HOME%\tools;
%ANDROID_HOME%\platform-tools;

In my case it was the path to my SDK folder that was causing this error.

C:\Users\username\AppData\Local\Android\android-sdk

changed to

C:\Users\username\AppData\Local\Android\sdk

gtrfrost

I have been having the same problem in windows. It appeared that when I was running the SDK Manager you have to select "Run as Administrator" otherwise it denies permission to install certain files, on of them being "ANDROID-22"

Here is the the link I found to resolve this issue: android sdk manger not updating

Open Android SDK Manager, and check whether the target version exists, Install if not exists.

Make sure your project path doesn't consist spaces.

I face the same problem asking me to install the target android platform when build. I have triple confirm my android sdk path, jdk path and various setting in path but still getting the same error. Finally, the problem resolved by simply renamed(removed spaces) the folder that store my Cordova project. For example : "C:\Cordova & Phonegap Sample\MyCordovaApp" to "C:\Cordova_Sample\MyCordova".

another way to fulfill an android target requirement would be:

$sdkmanager "platforms;android-21"

For those who run Visual Studio and have Mobile Development with JavaScript installed, you can run C:\ProgramData\Microsoft\AndroidSDK\25\tools\android.BAT and then proceed to install Android 5.0.1 or the relevant API.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!