Error executing command 'ant' on Mac OS X 10.9 Mavericks when building for Android with PhoneGap/Cordova

后端 未结 7 1262
谎友^
谎友^ 2020-11-29 17:04

Today I tried PhoneGap/Cordova with Mac OS X Mavericks. Building for iOS went just fine, but building for Android wasn\'t without some guesswork.

I

相关标签:
7条回答
  • 2020-11-29 17:31

    For OSX your path needs to include /Users/yourusername

    their example: /Development/adt-bundle/sdk/platform-tools
    needs to be: /Users/yourusername/Development/adt-bundle/sdk/platform-tools

    0 讨论(0)
  • 2020-11-29 17:35

    As an alternative to homebrew, you could download and install macports. Once you have macports, you can use:

    sudo port install apache-ant

    0 讨论(0)
  • 2020-11-29 17:39

    You can install ANT through macports or homebrew.

    But if you want to do without 3rd party package managers, the problem can simply be fixed by downloading the binary release from the apache ANT web site and adding the binary to your system PATH.


    For example, on Mountain Lion, in ~/.bash_profile and ~/.bashrc my path was setup like this:

    export ANT_HOME="/usr/share/ant"
    export PATH=$PATH:$ANT_HOME/bin
    

    So after uncompressing apache-ant-1.9.2-bin.tar.bz2 I moved the resulting directory to /usr/share/ and renamed it ant.

    Simple as that, the issue is fixed.


    Note Don't forget to sudo chown -R root:wheel /usr/share/ant

    0 讨论(0)
  • 2020-11-29 17:50

    In my case, I have macport installed already. I simply updated my macport:

    sudo port selfupdate
    
    sudo port upgrade outdated
    

    Then install apache-ant:

    sudo port install apache-ant
    

    Finally, I add ant to my alias list in my .bash_profile:

    alias ant='/opt/local/bin/ant'
    

    Then you are all set.

    0 讨论(0)
  • 2020-11-29 17:52

    it don't needed port and brew! because you have android sdk package.

    .1 edit your .bash_profile

    export ANT_HOME="[your android_sdk_path/eclipse/plugins/org.apache.ant_1.8.3.v201301120609]" 
    
    // its only my org.apache.ant version, check your org.apache.ant version
    
    export PATH=$PATH:$ANT_HOME/bin
    

    .2 make ant command that can executed

    chmod 770 [your ANT_HOME/bin/ant]
    

    .3 test if you see below message. that's success!

    command line execute: ant

    Buildfile: build.xml does not exist!

    Build failed

    0 讨论(0)
  • 2020-11-29 17:53

    The error message proved to be true as Apache Ant isn't in the path of Mac OS X Mavericks anymore.

    Bulletproof solution:

    1. Download and install Homebrew by executing following command in terminal:

      ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

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

    0 讨论(0)
提交回复
热议问题