Home » Android » android – Installing PhoneGap, error executing command 'ant'

android – Installing PhoneGap, error executing command 'ant'

Posted by: admin June 15, 2020 Leave a comment

Questions:

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.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.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!

How to&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.

Answer:

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

Answer:

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

Answer:

Double check what you set ANT_HOME to, you can do that by opening a “command prompt” (Start -> Run -> CMD) and type echo %ANT_HOME%

Check if this is the correct directory that you have ANT installed into, otherwise set it. (The URL you linked to tells you how).

You can verify the ANT “installation” by typeing ant -version in a “command prompt” window.

Answer:

¿Did you create JAVA_HOME and ANT_HOME variables? ¿Did you also add to the PATH?

Answer:

Instead of creating the ant variable ANT_HOME, just insert the absolute path in your windows system variable PATH like this:

c:\yourDirectory\ant\bin;

Then it should work/run fine!