1

I'm using cordova 3.3.0 on Windows in cygwin, and I'm getting the following error when I try to add the android platform

Error: An error occured during creation of android sub-project. 

C:\Users\Mike\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:126
                throw e;
                      ^
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.

I have the latest available versions or java, ant and the android sdk api 19 installed, as well as the latest android tools, platform-tools and build-tools but the error persists. (I tried to post an image of my SDK Manager to show this but I don't have enough reputation :(

The end of my PATH variable contains the correct locations for android tools and platform-tools as suggested here

....:/cygdrive/c/Users/Mike/bin:/cygdrive/c/Tools/apache-ant-1.9.3/bin:/cygdrive/c/Tools/sdk/platform-tools:/cygdrive/c/Tools/sdk/tools:/cygdrive/c/Program Files/Java/jdk1.7.0_51/jre/bin

The strange thing is that my project used to build correctly, but then stopped working when nothing noticeable had changed. I've fixed this before by building a new cordova project, but now I get this error with a brand new HelloWorld cordova project:

Mike@Mike-VAIO /cygdrive/c/workspaces/apps
$ cordova create test com.example.test HelloWorld
Creating a new cordova project with name "HelloWorld" and id "com.example.test" at location "C:\workspaces\apps\test"

Mike@Mike-VAIO /cygdrive/c/workspaces/apps
$ cd test

Mike@Mike-VAIO /cygdrive/c/workspaces/apps/test
$ cordova platform add android
Creating android project...
Error: An error occured during creation of android sub-project. 

C:\Users\Mike\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:126
                    throw e;
                          ^
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.

I've tried reinstalling cordova but that doesn't help. Does anyone have any other ideas?

many thanks in advance

Community
  • 1
  • 1
Mikee
  • 61
  • 5

1 Answers1

1

You should check if Target 19 really exists. Go to your android SDK folder, then to platforms and check if there is a folder called android-19.

But still this looks like cordova is not able to point out your android SDK folder or your target 19 folder.

NovumCoder
  • 4,349
  • 9
  • 43
  • 58
  • Thanks for the reply - the platforms folder does exist. This is really strange - it started working again and now it has stopped again without anything obvious changing. I can't figure it out. – Mikee Feb 21 '14 at 11:17
  • Did you ever resolve this issue? I'm getting the same unpredictable behavior right now – thinkbigthinksmall Apr 05 '14 at 21:41
  • give that man a medal! this is the best way to check then you use android command to install whats missing (although you can check this through the android command straight away but when you get tired checking the directory shows the problem straightaway) – Andreas Sep 04 '14 at 17:23