Unable to compile for Android with Yosemite

Monkey Targets Forums/Android/Unable to compile for Android with Yosemite

Hezkore(Posted 2015) [#1]
I'm pretty new to Mac OS, and it seems I have joined the Mac world at a weird time as Yosemite has a lot of issues with paths and such.
But I've managed to get most things working, except for Android building with Monkey!
No matter what I install or how much I add to PATH, I just can't get any Android target working.
I've even tried Sub_Zero's Fully automatic target installer with no luck.

I'm on Monkey X Pro v83c

Here's my config.macos.txt:
'--------------------
'Monkey modules path
MODPATH="${MONKEYDIR}/modules;${MONKEYDIR}/modules_ext"
'--------------------

'--------------------
'HTML player path.
HTML_PLAYER=open -n "${MONKEYDIR}/bin/mserver_macos.app" --args
'--------------------

'--------------------
'Ant build tool path
ANT_PATH=“/opt/local/share/java/apache-ant“
'--------------------

'--------------------
'Flex SDK and flash player path.
'
'Must be set for FLASH target support.
'
FLEX_PATH="${HOME}/flex_sdk_4.9.1"
FLEX_PATH="${HOME}/flex_sdk_4.9"
FLEX_PATH="${HOME}/flex_sdk_4.6"
'
'for opening .swf files...monkey will use HTML_PLAYER if this is not set.
'FLASH_PLAYER="...?..."
'--------------------

'--------------------
'Android SDK and tool paths.
ANDROID_PATH=“/opt/local/share/java/android-sdk-macosx"
'--------------------

'--------------------
'Android NDK
ANDROID_NDK_PATH=“/opt/local/share/java/android-ndk-macosx“
'--------------------


Here's my PATH:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Volumes/Stuff/Applications/BlitzMax/bin:/opt/local/share/java/apache-ant/bin:/opt/local/share/java/apache-ant:/opt/local/share/java/android-sdk-macosx:/opt/local/share/java/android-sdk-macosx/platform-tools:/Volumes/Stuff/Applications/Monkey/bin


Here's what happens when I type "ant" in the Terminal:
Hezkore$ ant
Buildfile: build.xml does not exist!
Build failed


And here's what happens when I type "adb version" in the Terminal:
Hezkore$ adb version
Android Debug Bridge version 1.0.32


Everything seems to be in order?
Yet TED doesn't show Android as a target.


Boulderdash(Posted 2015) [#2]
I have to set up Monkey on three laptops, setup would be greatly simplified if wildcard characters where used in the config file because the version numbers keep updating.

No doubt all the version numbers are different to the ones you installed, unfortunately the folder path contains a version number so its not a static path, each update changes the path.


slenkar(Posted 2015) [#3]
you have to use the cd command to get to the right folder
it says build.xml doesnt exist in the current directory (cd)

so you would do something like this

cd /monkeygames/mygame/mygame.build/
ant


im using linux which uses the same command line commands
I usually navigate to the right folder using the gui and then press a button to bring up a terminal which has its current directory in that folder


Hezkore(Posted 2015) [#4]
Well the path isn't really an issue.
I was just typing "ant" to show that ant was installed and had its system PATH correctly set.
TED would take care of the actual paths, but Android doesn't even show up in TED.


slenkar(Posted 2015) [#5]
oh ok sorry i misunderstood


dawlane(Posted 2015) [#6]
Better late than never.
To actually get ant to work do this
Open a terminal
Run
nano .profile
pasted the code below, but change the path to the location of where ANT is installed
export ANT_HOME="$HOME/sdks/apache-ant-1.9.4"
export PATH="$ANT_HOME:$PATH"

to save use Ctr+O, press Enter
to exit nano Ctrl+X
log out and log back in.
The snippet does two things
Sets the ANT_HOME and adds it to the system path system variable. It also makes them persistent for the current user.
If you need to do it on a system wide bias, I would suggest that you look up on how to add paths and system variable to make OS X.


Hezkore(Posted 2015) [#7]
@dawlane I have set ANT_HOME already.
Hezkore$ echo $ANT_HOME
/opt/local/share/java/apache-ant

Ant is working and is correctly installed.

Either way, I don't think you need to set ANT_HOME for TED to actually show Android as a target, as TED never looks at ANT_HOME (Only Ant itself does).
TED just doesn't seem to want to acknowledge that I've installed everything already.


Danilo(Posted 2015) [#8]
@Hezkore:
Your config.macos.txt is missing JDK_PATH.


dawlane(Posted 2015) [#9]
Well I have spent the last 3 hours digging around and discovered that the child process bug in Yosemite is still present; according to the bug reports it's been fixed. This is a bug where a child process isn't inheriting it's parents PATH and system variables when launch via clicking the app bundle. If you invoke Ted directly, then the PATHS are set, but for some reason tcc.ANDROID_PATH is still empty thus causing android not to be registered, I will have to see whats going on there. Forcing it will still cause problems with trying to use ant and android sdk that is installed with macports. Manually installing ant and the sdks into the home directory will work as long as you export the ant path in the local user profile.


dawlane(Posted 2015) [#10]
OK found a work around using macports which I assume Hezkore is using.
Clean install of Yosemite.
Make sure that you install the latest Oracle JDK from the dmg image file.
Install xcode and then the command line tools.
Install macports and then use macports to install apache-ant, android and android-ndk
Run the android sdks manager as sudo and install API 19, and/or API 13 (need to check the obsolete check box to see that one)

Now as systems variables are not being inherited when executables using the command shell are invoked from a GUI application; plus the command shell is ignoring profile in most cases, but not bash_profile. You have two choices, either create a bash_profile in /etc or create .bash_profile on in your home directory.
You then have to set the variables required by MonkeyX into the bash_profile
export PATH="/opt/local/bin:/opt/local/sbin:$PATH”
export ANT_PATH="/opt/local/share/java/apache-ant"
export ANDROID_PATH="/opt/local/share/java/android-sdk-macosx"
export ANDROID_NDK_PATH="/opt/local/share/java/android-ndk-macosx"
export PATH="$ANDROID_NDK_PATH:$ANDROID_PATH:$ANT_HOME:$PATH”


MonkeyX will also need ANDROID_PATH, ANDROID_NDK_PATH and ANT_PATH setting exactly to the same paths.
Reboot if you added bash_profile to /etc or log out if it’s in the user home directory.