Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing PhoneGap, error executing command 'ant'

When installing PhoneGap via nodeJS i got an error when trying to run my app (installing phonegap and creating the app worked):

C:\Users\arko\my-app>phonegap run android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
    [error] An error occured during creation of android sub-project.

C:\Users\arko\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:126
                throw e;
                      ^
Error: ERROR : executing command 'ant', make sure you have ant installed and add
ed to your path.
    at C:\Users\arko\.cordova\lib\android\cordova\3.3.0\bin\lib\check_reqs.js:47
:27
    at ChildProcess.exithandler (child_process.js:641:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Socket.<anonymous> (child_process.js:956:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:465:12)

So I noticed I never had ANT installed, so I did. I followed this tutorial: http://cleancodedevelopment-qualityseal.blogspot.nl/2012/11/how-to-install-phonegap-for-android.html and done everything it said.

The part it says you have to add stuff to the Path variable, it said just add this: %ANT_HOME%\bin; however my Path ended with this: C:\Program Files\Windows Live\Shared - so I added this to it: ;%ANT_HOME%\bin;

Tried to run the android app again, and got the same error. I ran it with this command:

phonegap run android

What am I doing wrong?

Thanks!

like image 361
Arko Elsenaar Avatar asked Feb 24 '14 10:02

Arko Elsenaar


3 Answers

Probably you have a new version of cordova, i saw that in a partner machine was installed the cordova version 3.5.0 and in my machine it was installed the 3.4.0 version, maybe the ant version is incompatible with the new version of cordova (He and i has the ant version 1.9.4) .

Try install a old version of cordova with this command in the node.js console:

    npm install -g [email protected] 

and run the command again.

Other cause: Verify that your Path Variables are configured correctly..

My english is not pretty good, but i hope help you to solve the problem.

like image 119
hardvin Avatar answered Nov 06 '22 02:11

hardvin


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

then define system paths

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

reboot your computer

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

like image 3
Somwang Souksavatd Avatar answered Nov 06 '22 03:11

Somwang Souksavatd


Set the path for ant in your system variables, and use that variable path in your user variables. After setting both, restart your computer so they take effect.

User variables:

PATH = %ANT_HOME%/bin

System variables:

ANT_HOME = c:\your directory

such as

ANT_HOME = C:\ant
like image 1
Krishna Patel Avatar answered Nov 06 '22 04:11

Krishna Patel