简体   繁体   中英

Error doing cordova platform add android in cordova 3.3

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM