I'm trying to successfully install and create an app with cordova but it doesn't works. So I've Googled and read many threads here on Stack Overflow but it hasn't helped.
Here's my problem: If I try to add the Android platform via CMD with
cordova platform add android
I get the folowing error:
Error: ERROR : executing command 'ant', make sure you have ant installed and added
to your path.
at C:\Users\user\.cordova\lib\android\cordova\3.4.0\bin\lib
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)
Error: cmd: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\user\AppData\Roaming\npm
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
I've downloaded Apache ant and unzipped it into C:\\ant
. My env vars are the following:
Path:
C:\Program Files\nodejs\;C:\dev\adt-bundle-windows-x86_64-20131030\sdk\platform-
tools;C:\dev\adt-bundle-windows-x86_64-20131030\sdk\tools;C:\Program
Files\Java\jdk1.7.0_40;C:\ant
(I tried c:\\ant\\bin
and c:\\ant
) JAVA_HOME:
C:\Program Files\Java\jdk1.7.0_40
ANT_HOME:
C:\ant
And it still isn't working. How can I fix this?
Use this one
Install ant using brew
Download and install Homebrew by executing following command in terminal:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Install Apache Ant via Homebrew by executing
brew install ant
Run the PhoneGap build again and it should successfully compile and install your Android app.
add C:\\ant\\bin; in your system path.
Then open cmd prompt. type ant -version if show like this. you will fix it.
ant -version
Apache Ant(TM) version 1.9.2 compiled on July 8 2013
if it's didn't resolve your problem then check your ant install path. May be C:\\Program Files\\ant\\bin .then add it to your system path. enjoy your code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.