OS X Maverick - Can't build Android - Missing Ant

Monkey Forums/Monkey Programming/OS X Maverick - Can't build Android - Missing Ant

Difference(Posted 2013) [#1]
I can't build to Android on OS X 10.9

TRANS monkey compiler V1.54
Parsing...
Semanting...
Translating...
Building...
sh: ant: command not found
TRANS FAILED: Android build failed.
Done.

As far as I can tell Maverick does not come with Ant Preinstalled, but I've not got it set up right yet.

Please advice...

Do I download this: http://ant.apache.org/bindownload.cgi and set $PATH and $ANT_HOME, and if yes, where ?


computercoder(Posted 2013) [#2]
According to this post, you can get ant using brew.

Hope this helps :)


Difference(Posted 2013) [#3]
this seems to say I shouln't: brew : http://nathancahill.github.io/installing-homebrew-on-mac-osx-mavericks/


Difference(Posted 2013) [#4]
I downloaded http://ant.apache.org/bindownload.cgi

Did this to get ant/bin in my path:

http://architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/#.Umgx1JS9QmK

Used this http://diaryproducts.net/EnvPane to set $ANT_HOME


I've now got a valid $ANT_HOME and /opt/ant in my path, and can run

ant -version and get "Apache Ant(TM) version 1.9.2 compiled on July 8 2013"

but the error persists...


computercoder(Posted 2013) [#5]
Very interesting. Glad you found that article :)

Perhaps the config file for ANT_PATH isn't set in Monkey?


Difference(Posted 2013) [#6]
Thanks for the heads-up , but I'm afraid ANT_PATH is being ignored on OS X

I tried setting ANT_PATH=“/opt/ant" in config.macos.txt , but it doesn't help.


Difference(Posted 2013) [#7]
but setting FLEX_PATH="/opt/ant" gets me compiling :-) :-)

This adds Ant location to trans' setenv path statement.

Some work for Mark here, to get this working for Maverick users.


computercoder(Posted 2013) [#8]
Very cool :) I have to wait a few months before I get my hands on a new Mac to play with Mavericks. Glad you got it working though :)

Hopefully by then Monkey will have this sorted out in the build!


Spinal(Posted 2013) [#9]
I'm having no luck at all getting this to work. I installed ant, which is now at "opt/local/share/java/apache-ant/bin/"

which is set in my $PATH but I'm getting the "sh: ant: command not found" error.
I tried Difference solution -

FLEX_PATH="/opt/local/share/java/apache-ant/bin/"

didn't fix anything.

Any ideas?


Difference(Posted 2013) [#10]
Just guessing, but maybe you do need setting the $ANT_HOME too?


Spinal(Posted 2013) [#11]
I'm not really a mac person, where/what is $ANT_HOME?


programmer(Posted 2013) [#12]
ANT_PATH?
Actually Monkey doesn't use ANT_PATH on Mac OS X. Only on Windows:
(transcc.monkey source code)
Select HostOS
Case "winnt"
	Local path:=GetEnv( "PATH" )
	
	If ANDROID_PATH path+=";"+ANDROID_PATH+"/tools"
	If ANDROID_PATH path+=";"+ANDROID_PATH+"/platform-tools"
	If JDK_PATH path+=";"+JDK_PATH+"/bin"
	If ANT_PATH path+=";"+ANT_PATH+"/bin"
	If FLEX_PATH path+=";"+FLEX_PATH+"/bin"
	If MINGW_PATH path=MINGW_PATH+"/bin;"+path

	SetEnv "PATH",path
	
	If JDK_PATH SetEnv "JAVA_HOME",JDK_PATH

Case "macos"

	Local path:=GetEnv( "PATH" )
	
	If ANDROID_PATH path+=":"+ANDROID_PATH+"/tools"
	If ANDROID_PATH path+=":"+ANDROID_PATH+"/platform-tools"
	If FLEX_PATH path+=":"+FLEX_PATH+"/bin"
	
	SetEnv "PATH",path
	
Case "linux"

	Local path:=GetEnv( "PATH" )
	
	If JDK_PATH path=JDK_PATH+"/bin:"+path
	If ANDROID_PATH path=ANDROID_PATH+"/platform-tools:"+path
	If FLEX_PATH path=FLEX_PATH+"/bin:"+path
	
	SetEnv "PATH",path
	
End



Spinal(Posted 2013) [#13]
After looking again at the above solution, it seems my error was including the "/bin/" in the path.
FLEX_PATH="/opt/local/share/java/apache-ant" looks like it did the trick.


Difference(Posted 2013) [#14]
@Spinal : great

@programmer:

ANT_PATH?
Actually Monkey doesn't use ANT_PATH on Mac OS X. Only on Windows:

... which is why we're cheating and setting FLEX_PATH because Monkey adds that to it's PATH.


Panda(Posted 2013) [#15]
Thanks for this info, everyone. Helped me out!

I need to stop upgrading my software, because every time I do some part of Ted/Monkey breaks. Since going to Mavericks my GLGW builds no longer work either but that's off topic.


Tristan(Posted 2013) [#16]
I am having this issue and unable to get it working, I have tried a direct path and tried the steps above, no dice. Any clues on what the issue might be? Is there a cache I need to clear somewhere for the config files?


Tristan(Posted 2013) [#17]
So I was able to build the app from the command line by going into the build directory for android for the monkey app, and run "ant debug install". It ran fine, anyone know how to make monkey see ant correctly?

(Sorry for taking over the thread, I didn't want to make a totally new thread for the same issue..)


computercoder(Posted 2013) [#18]
My wife was REALLY nice to me and gave me my Christmas a wee early :) I got my new MacBook Pro 15" laptop with a vanilla installation of Mac OS X Mavericks pre-installed.

There are a few things I did to make monkey finally build against ant. Since there is no longer an /opt folder, I had to use /usr instead. No big deal, just schematics :)

1) Download the binary release from the Apache Ant downloads page

I simply just downloaded the zip file and when the download is finished, the files automatically are extracted.

The folder left behind will be *as of Nov 16, 2013* is apache-ant-1.9.2. If a newer release is available, it will look similar to this.

2) Copy the entire folder to /usr/share on your Mac. If you do not know how to get there, simply open Finder, click on the "Go" menu item, then select "Go to Folder..." and enter /usr/share and then click the "Go" button.

You *may* be asked to authenticate copying and pasting or renaming ANYTHING in this folder. After all, it IS a hidden systems folder for a reason. :)

3) Copy and paste the extracted folder you did in step 2 into the /usr/share folder.

4) Rename the folder apache-ant-1.9.2 to ant. Again, you *may* need to authenticate this action.

5) Open a Terminal window.

6) At the terminal prompt, enter each of the following lines, make sure to hit enter after each line:
export ANT_HOME="/usr/share/ant"
export PATH=$PATH:$ANT_HOME/bin

Doing this step tells the OS (and command line) where to locate the ant application.

7) Open monkey and load the "config.macos.txt" file and change the FLEX_PATH value to the following. There may be more than one, just delete all but one line.
FLEX_PATH="/usr/share/ant"

This will tell monkey where ant is located.

8) Save the file and close monkey.

9) Relaunch monkey and try executing your app :)

Don't forget to first grab all the Android SDK files first, otherwise it will error stating it cannot locate those files when it tries to build as well.

[EDIT]
If you want to make these changes stick so that you no longer need to keep exporting the commands each time you launch Terminal, do the following steps. *NOTE* I also went ahead and setup the android tools as well. You can choose to add them if you like or not. Make sure you include at least the ant portion to get monkey to work compiling with it.

1) Enter the following command at the terminal bash prompt:
vim ~/.bash_profile

2) To start adding entries to the file, press the [A] key. This will allow you to enter text on each line.

3) Enter in the following lines. Since this is a LINE EDITOR, be sure to press the enter key between lines and DO NOT use the arrow keys to advance to the next line.

Please note that ANDROID_HOME is set to the path you have installed the Android SDK, on my computer, I chose to place it under my home directory called android-sdk-macosx
export ANDROID_HOME=~/android-sdk-macosx
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform_tools
export ANT_HOME=/usr/share/ant
export PATH=$PATH:$ANT_HOME/bin

4) Save the file by first pressing the [Esc] key twice, then type in :x and press the [Enter] key

5) Enter the following command at the terminal bash prompt:
source ~/.bash_profile



monkeyteets(Posted 2014) [#19]
This should really be in the monkey docs, as a new purchaser, left me abit in the dark with a hint of buyers remorse,

I even put the ant that comes with the android sdk tools eclipse/plugins/org.apache.ant_1.8.3.v201301120609/bin , I downloaded the ant bin from above and added it to my PATH

In Terminal;
$ ant
Buildfile: build.xml does not exist!
Build failed



After login/logout and running Monkey.app

TRANS monkey compiler V1.56
Parsing...
Semanting...
Translating...
Building...
sh: ant: command not found
TRANS FAILED: Android build failed.
Done.



So I open up Terminal, run
export PATH=/Users/_/android-sdk-macosx/platform-tools:/Users/_/android-sdk-macosx/tools:/Users/_/apache-ant-1.9.3/bin:$PATH
(this is also in my ~/.bash_profile
then
open /Applications/MonkeyPro75d/Monkey.app

I then at least get


"/Applications/MonkeyPro75d/bin/transcc_macos" -target=Android_Game -config=Debug -run "/Applications/MonkeyPro75d/modules_ext/congo/examples/clocktest/myapp.monkey"
TRANS monkey compiler V1.56
Parsing...
Semanting...
Translating...
Building...
Buildfile: /Applications/MonkeyPro75d/modules_ext/congo/examples/clocktest/myapp.build/android/build.xml

-check-env:
[checkenv] Android SDK Tools Revision 22.0.0
[checkenv] Installed at /Users/_/android-sdk-macosx

-setup:
[echo] Project Name: MonkeyGame
[gettype] Project Type: Application

-pre-clean:

clean:
[getlibpath] Library dependencies:
[getlibpath] No Libraries
[subant] No sub-builds to iterate on

BUILD SUCCESSFUL
Total time: 1 second
Buildfile: /Applications/MonkeyPro75d/modules_ext/congo/examples/clocktest/myapp.build/android/build.xml

-set-mode-check:

-set-debug-files:

-check-env:
[checkenv] Android SDK Tools Revision 22.0.0
[checkenv] Installed at /Users/_/android-sdk-macosx

-setup:
[echo] Project Name: MonkeyGame
[gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:

BUILD FAILED
/Users/_/android-sdk-macosx/tools/ant/build.xml:479: SDK does not have any Build Tools installed.

Total time: 2 seconds
TRANS FAILED: Android build failed.
Done.



So ... did it succeed and then fail? what?


monkeyteets(Posted 2014) [#20]
It was a problem with updating to version 22 and build-tools folder didn't get created even when updated via sdk manager, fresh download worked great along with installing the android-13 sdk