5

I'm using the latest ionic-box as of 27th April 2015. I've been able to ionic platform add android but getting the following error when ionic build android:

[Error: Please install Android target: "android-22".
Hint: Open the SDK manager by running: /home/vagrant/android-sdk-linux/tools/android 

You will require:  
1. "SDK Platform" for android-22  
2. "Android SDK Platform-tools (latest)  
3. "Android SDK Build-tools" (latest)]  

I've tried updating the sdk with the following command

android update sdk --no-ui

where I get the output of fetching a number of "https://dl-ssl.google.com/android*" File not found. However, if i copy that url and paste it on a browser the file is there.

My vagrant box is now bridged on the network to have direct access to the internet, since NAT was giving me the same errors.

Any help is much appreciated.

Tim
  • 41,901
  • 18
  • 127
  • 145
Rodrigo Rubio
  • 1,686
  • 2
  • 16
  • 26

3 Answers3

9

Follow these steps.
1) Type android on command line.(Make sure ANDROID_HOME and PATH are set properly)
2) Select API 22 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.

Shamsher
  • 1,761
  • 4
  • 21
  • 30
  • 1
    what if i have the target sdk to something lower than 22 and this keeps popping up when i build ? not even cordova platform update android worked – astroanu Jun 13 '15 at 15:14
3

i work around this by changing https to http or vise versa, in options but as a quick fix for supporting andorid API 21 like @astroanu commented this will help. it will add the support of API 21 in project.

$ cordova platforms remove android
$ cordova platforms add android@3.7.1
Abdul Hameed
  • 1,008
  • 1
  • 15
  • 35
2

I was able to build an android apk by doing the following:

  1. Open up the SDK manager after downloading/installing the android SDK (android studio). AndroidStuido>Appearance&Behavior>System Settings>Android SKD. Alternatively, you can just click on the "SDK Manager" button on the "Welcome to Android Studio" window that appears when you open Android Studio.
  2. Under SDK Platforms, click on Android 5.1.1 - API Level 22 and hit apply to install the package.
Nick Brady
  • 6,084
  • 1
  • 46
  • 71