Cordova for android: An error occurred while listening android targets

前端 未结 5 1090
难免孤独
难免孤独 2020-12-29 15:30

I have read all the questions for the same problems and I have tried everything but nothing is working for me when I try to add android platform for cordova.



        
5条回答
  •  孤独总比滥情好
    2020-12-29 16:19

    -Possible solution for those who encounter this error

    I had this error and it did relate to the path variables. I thought I had everything set correctly, but I was missing a portion.

    First check by typing the command android into command line. If the SDK isn't opened you have not set the variables and/or path correctly.

    You should have 3 (or 4 if you have separate android ones) variables.

    ANT_HOME, JAVA_HOME and ANDROID_HOME
    

    ANDROID_HOME should point to the sdk. If you (like I did) downloaded the bundle which includes eclipse, you need to have this variable point to the sdk folder inside the android bundle folder, not the android bundle folder itself (eg. C:\Dev\adt-bundle-windows\sdk)

    You need to add %ANDROID_HOME%\tools and %ANDROID_HOME%\platform-tools to your path. Along with the link to the ANT bin folder and jdk bin.

    I strongly urge you to triple check that all variables are correctly set AND that all four parts are added to the path.

提交回复
热议问题