Search code examples
cordova-3

Yosemite + Cordova, Ant build error


Just upgraded to Yosemite and tried running cordova build in my project folder as usual but am getting executing command 'ant' make sure you have ant installed and added to your path error. I have also installed the latest Java (8 JRE) as I was prompted to do so. Currently on version 3.6 of Cordova.

Update

VicM's answer worked perfectly but I had to also install the latest JDK (8). Here is my bash_profile now:

#export ANT_HOME=~/Desktop/adt-bundle-mac-x86_64-20131030/eclipse/plugins/org.apache.ant_1.8.3.v201301120609
export ANDROID_SDK_HOME=~/Desktop/adt-bundle-mac-x86_64-20140702/sdk
export ANT_HOME=~/Desktop/apache-ant-1.9.4
export PATH=/usr/local/bin:$PATH
export PATH=$PATH:$ANT_HOME/bin
export PATH=$PATH:$ANDROID_SDK_HOME/tools
export PATH=${PATH}:$ANDROID_SDK_HOME/platform-tools
export PATH=${PATH}:~/Desktop/dart/dart-sdk/bin

Solution

  • I just recently stumbled upon the same thing, but it was because I started to use the new Android Studio.

    These are the steps I followed:

    Steps to install ant:

    1. Download ANT ZIP file from http://ant.apache.org/bindownload.cgi
    2. Modify the .bash_profile to create and ANT variable
    3. Add the ANT bin folder to the path
    4. Restart the terminal
    5. Check is ANT was installed with "which ant"

    My bash profile look like this, be aware that you need to use your paths, mine are only for reference.

    # Android studio SDK path
    export ANDROID_SDK_HOME="/Applications/Android Studio.app/sdk"
    export ANT_HOME="/Applications/Development/apache-ant-1.9.4"
    
    export PATH=$PATH:$HOME/bin:$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$ANT_HOME/bin;