Title: Phonegap always asks me to install android sdk 19 but i have already installed it
Tags: android;cordova
Question: 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! :(

Comment: yup :( checked million times, changed the folder, restarted my pc, but no hope.

Comment: Yes , it runs with no problem

Comment: maybe reinstall my phonegap?

Comment: Have you checked to make sure your $PATH includes the 'tools' and 'platform-tools' paths for the android 19 sdk?

Comment: are you able to run 'android' from the command line?

Comment: It's probably worth trying. I can't think of anything else right now

Comment: have you checked permissions on the sdk folder and files? maybe it's not accessible to system?

Here is the accepted answer: 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.

Comment for this answer: This solved this very annoying problem for me. Thanks for the short and simple directions.
Comment for this answer: The wording of the error message sucks, but this helped Curtis. 

"Target" = API, and it's version 4.4.2. There's some cordova dependency which depends on this package, although I couldn't tell you what it is exactly.

Nice work Curtis!

Here is another answer: For Windows, in the Environment Variable try place the java\bin directory before the windows\system32 directory.  

This makes the SDK Manager to use java from java\bin directory else it would use java found in the system32 folder.

This should help!


Here is another answer: I was able to solve this problem by checking if the environment variables were detected in the current working directory or not.
The directory where I was running phonegap run android wasn't able to detect the andorid environment variable so I copied it to another directory c:/users//<> and tried again it worked.

It might happen if your sdk is not installed in c: drive (Primary Partition)

Comment for this answer: ! it wokred for me! I just installed my SSD on laptop, and could not add android platform while working on another hard drive! thank you very much Viki293.

Here is another answer: 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:


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.
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.

Comment for this answer: In Windows 7 I find three project.properties files under /Users/username/.cordova. One (in ~templates) says "target=This_gets_replaced". Two say "target=android-19". One of these is in C:\Users\username\.cordova\lib\npm_cache\cordova-android\3.6.4\package\test\project.properties, and one is in C:\Users\username\.cordova\lib\npm_cache\cordova-android\3.6.4\package\framework\project.properties. Based on the previous comment, I would change the one in framework, but if problems arise subsequently it may be helpful to know that the other one exists.
Comment for this answer: Thanks ! I updated the **/Users/username/.cordova/lib/android/cordova/3.5.0/framework/project.properties** to _android-20_ and it worked !!!

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 5, 'CommentCount': 7, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2014:00:02/10/14', 'FavoriteCount': 5.0, 'PostTypeId': 1, 'Tags': '<android><cordova>', 'Title': 'Phonegap always asks me to install android sdk 19 but i have already installed it', 'ViewCount': 10242, 'id': 21685504, 'user_AboutMe': '', 'user_AccountId': 3463611.0, 'user_DisplayName': 'John', 'user_Reputation': 570.0, 'user_Views': 42.0, 'user_id': 2899882.0}}