cordova platform add android not working while listing Android targets

后端 未结 12 1768
野趣味
野趣味 2020-11-29 16:48

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 :

12条回答
  •  执笔经年
    2020-11-29 17:25

    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:\sdk\android directory
    • you have installed you Apache ant to the c:\tools\apache-ant directory

    Then you must create two system variables:

    1. ANDROID_HOME with the c:\sdk\android value
    2. ANT_HOME with the c:\tools\apache-ant value

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

    ;%PATH%\tools;%ANT_HOME%\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
    

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

    More documentation available here.

提交回复
热议问题