Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap always asks me to install android sdk 19 but i have already installed it

This is what exactly i do :

$ phonegap create myapp
$ cd myapp
$ phonegap run android

but it fails.

I have checked everything. my environments are ok, installed the latest version. when i type

$ android

on my CMD it shows me that every latest updates are already installed but can not make it work :

$ phonegap run android

it returns :

                         ^
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.
    at C:\Users\yeayea\.cordova\lib\android\cordova\3.3.0\bin\lib\check_reqs.js:
80:29

please help otherwise i will hang myself! :(

like image 206
John Avatar asked Feb 10 '14 18:02

John


Video Answer


2 Answers

I had the same problem and I thought I had API 19 installed but I didn't.

In CMD type "android"

Scroll down to Android 4.2.2 (API 19)

Check all and install them.

Even if you already have API 20 installed and all the other packages and tools installed, you need this.

like image 167
Curtis Avatar answered Oct 19 '22 12:10

Curtis


When you run phonegap create myApp, there is a script which checks that you have a specific android platform version. The platform it is looking for is in the file (for OS X): /Users/username/.cordova/lib/android/cordova/3.5.0/framework/project.properties and for Cordova 3.5.0 has the line: target=android-19

Cordova and PhoneGap are the same in this regard so any reference to cordova also applies to phonegap.

To check that you have this target run: android list targets and you should have an entry like:

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

By default only the latest target is installed which is currently android-20.

You have two options:

  1. Install the target that matches what is in the project.properties file. This would seem to be the best approach as this would be the target cordova was tested against.
  2. Edit the project.properties file to match a target on you have installed. This should get you past this problem but could have unexpected impacts.

To install an additional target, as Curtis said, run the Android SDK Manager (android) and select the Android target you require. Note these appear below the Tools folder which also has a number of different versions, but installing a different version of the tools will not solve this problem.

You can also see the targets you have installed in the platforms directory of the Android sdk.

like image 45
oenpelli Avatar answered Oct 19 '22 12:10

oenpelli