Cannot get ant installed properly for phonegap using eclipse and windows 8

Rex_C picture Rex_C · Oct 18, 2013 · Viewed 41.1k times · Source

Trying to use Phonegap in Eclipse on windows 8. I've created a project at C:\Development\HelloWorld. In the command line, when I type:

phonegap local build android

I get the following error:

An error occurred during creation of android sub-project. ERROR : executing command 'ant', make sure you have ant installed and added to your path.

My PATH:

C:\Program Files\nodejs\;C:\Development\adt-bundle\sdk\platform-tools;C:\Development\adt-bundle\sdk\tools;%JAVA_HOME%\bin;%ANT_HOME%\bin;

Whats going wrong? I have downloaded Ant into my Development folder and all other necessary downloads are downloaded as well. Any help would be appreciated.

Answer

Rex_C picture Rex_C · Oct 21, 2013

I was following Phonegap's platform guide for Android and I kept getting the above error. The directions on the guide were a little confusing. I went back to check what I had installed and found some configuration errors.

Under Environment Variables, I created new ANDROID_HOME, ANT_HOME, and JAVA_HOME system variables with the respective physical file paths as the value. This part may be overkill, but I was trying to cover my bases and I have noticed no significant issues with it so far.

Example:

Variable: ANDROID_HOME Value: C:\Development\adt-bundle\sdk

Variable: ANT_HOME Value: C:\Development\apache-ant-1.9.2

Variable: JAVA_HOME Value: C:\Program Files\Java\jdk1.6.0_45

Next I added the following values to the Path system variable in Environment Variables:

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

After making these changes and continuing to follow the guide, everything worked like it should. It boiled down to not having my system variables set to the correct physical file path.