Cordoba: [Error: set Android target: "android-21"

I just updated cordova + ionic in my application, after which I successfully installed Android-SDK v22 through the Android SDK manager.

But after executing the command:

cordova build android 

I always get the following message:

 Running command: /Users/peter/workspace/myapp/platforms/android/cordova/build [Error: Please install Android target: "android-21". Hint: Open the SDK manager by running: /Users/peter/adt-bundle-mac/sdk/tools/android You will require: 1. "SDK Platform" for android-21 2. "Android SDK Platform-tools (latest) 3. "Android SDK Build-tools" (latest)] ERROR building one of the platforms: Error: /Users/peter/workspace/myapp/platforms/android/cordova/build: Command failed with exit code 2 You may not have the required environment or OS to build this project Error: /Users/peter/workspace/myapp/platforms/android/cordova/build: Command failed with exit code 2 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23) at ChildProcess.emit (events.js:110:17) at maybeClose (child_process.js:1008:16) at Process.ChildProcess._handle.onexit (child_process.js:1080:5) 

I also tried

 cordova platform rm android cordova platform add android 

But with the same result:

I tried to find a few hours for any working solution, but with luck.

Thanks for any advice.

System Information:

 OS: Mac OS X Yosemite Node Version: v0.12.0 Cordova CLI: 4.3.0 Ionic Version: 0.9.27 Ionic CLI Version: 1.3.18 Xcode version: Xcode 6.2 Build version 6C131e ios-sim version: 3.1.1 ios-deploy version: 1.4.0 
+49
android cordova android-sdk-tools ionic-framework
Apr 01 '15 at 16:39
source share
9 answers

I had the same problem. I had to change the goal:

 # 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" /> 
+113
Apr 10 '15 at 2:23
source share

Follow these steps. 1) Enter android at the command prompt (make sure ANDROID_HOME and PATH are installed correctly)
2) Select API 21 from the completed list.
3) Click install packages .
4) Enter android avd at the command prompt.
5) Set the API level and other configuration.
6) Now enter ionic build android .

+24
Apr 29 '15 at 9:34
source share

Many times, the problem is that the ANDRIOD_HOME path environment variable is not configured. Take a look

 %ANDROID_HOME% = C:\Program Files (x86)\Android\android-sdk In Path: %ANDROID_HOME%\tools; %ANDROID_HOME%\platform-tools; 
+10
Sep 08 '15 at 22:59
source share

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

C: \ Users \ username \ AppData \ Local \ Android \ Android-SDK

changed to

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

+3
Oct 05 '15 at 12:40
source share

I have the same problem on Windows. It turned out that when I started the SDK manager, you need to select "Run as administrator", otherwise it will refuse permission to install certain files, of which "ANDROID-22"

Here is the link I found to solve this problem: Android sdk manger does not update

+1
May 28 '15 at 10:46
source share

Open the Android SDK Manager and check if the target version exists, install if it does not exist.

+1
Sep 30 '15 at 7:43
source share

Make sure your project path does not contain spaces.

I am facing the same problem asking me to install the target Android platform during assembly. I have triple confirmation of my android sdk path, jdk path and various settings in the path, but still getting the same error. Finally, the problem was solved by simply renaming (deleted spaces) the folder in which the Cordoba project is stored. For example: "C: \ Cordoba and Sample calling card \ MyCordovaApp" to "C: \ Cordova_Sample \ MyCordova".

0
Mar 29 '16 at 2:31 on
source share

Another way to fulfill the Android goal requirement:

 $sdkmanager "platforms;android-21" 
0
Sep 05 '17 at 20:37 on
source share

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

enter image description here

0
Apr 10 '19 at 13:23
source share



All Articles