Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

windows - cordova platform add android not working while listing Android targets

I got problem when i want to add an android platform to my phoneGap application. I got this message in my CLI when i execute the command cordova platform add android :

Checking Android requirements... (Error: An error occurred while listing Android targets)

I already try to add my android sdk location in the path variable.

Please help me ! :D

I work on Windows 7 64 bits, i install the android API 17, 18 and 19 with the android SDK. I am on 3.2 phoneGap version.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

To work, this cordova command needs to use some programs located into your sdk/tools directory. You need also have installed apache ant.

Then you must add these directories into your PATH system variable:

Background:

  • let's assume you have installed your Android SDK to the c:sdkandroid directory
  • you have installed you Apache ant to the c:oolsapache-ant directory

Then you must create two system variables:

  1. ANDROID_HOME with the c:sdkandroid value
  2. ANT_HOME with the c:oolsapache-ant value

Finally, you must modify the PATH variable and add those two to the end of the PATH' value:

;%PATH%ools;%ANT_HOME%in;%ANDROID_HOME%ools;%ANDROID_HOME%platform-tools

NOTE: for those who uses Linux, the instruction differs a bit.

More documentation available here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...