How do I setup Android Target for a Mac ?

Monkey Forums/Monkey Beginners/How do I setup Android Target for a Mac ?

Boulderdash(Posted 2014) [#1]
I have to ask for help again, I can't find anything specific in the help docs of Monkey ?
it might be better to say I think the instructions have been written for a user who is already very experienced at setting up Monkey, not a first time user ?

I have downloaded the SDK's and dragged them from "Downloads" to "Applications" etc
now I don't know how to set the paths to this in the config file ? where is {home} ?

Help ! (I'm using Mavericks on a Macbook 6.1 )

Are there instructions for setting up for a Mac anywhere ?


dawlane(Posted 2014) [#2]
I will be nice and post my notes on how I do it. They may work for you. Don't drag every thing into the Applications directory. It's meant of for applications. Instead make a directory in your home {home} folder called sdk and place software development kits and tools in there.

My notes at some point I will do a proper how to.
Monkey-X Installation on OS X

NOTE: Before downloading any files go in to the Safari Preferences and uncheck Open "safe" files after downloading to stop archive files being automatically extracted.

------------------------------------------------------------------------------------------------------------------------------------------------
Installing Xcode
Current version xcode_5.0.2.dmg as of Feb 2014 requires OS X 10.8.4
Includes iOS 7.0.3 SDK and OSX 10.9 SDK.

You can get Xcode via the Apple App store or go to the apple developer web site https://developer.apple.com/xcode/index.action
You will need to have an apple ID to download anything.

The developers download site is a bit messy to find what you are looking for. Use the pane on the left to narrow the Categories to just the Developer Tools and use the the search bar above it to look for Xcode. The latest is usually at the top of the list. It’s a big download at 2GB+ and includes the developer toolset for Mac, iPhone, iPod touch, iPad and includes iOS SDK with the latest version of the OS X SDK.

Once it has downloaded double click the .dmg image found in the downloads directory to mount it. It will open a window that will show two icons and a arrow between them. The icon named Xcode can be drag-n-dropped into the icon named Applications. You can then double click the Applications icon to take you the where Xcode has just been installed or use finder and navigate to Applications in Favourites. You can close the Xcode disk (dmg) image file and unmount (eject) it as it is no longer needed. You can eject by right clicking the Xcode drive icon and selecting Eject or open finder to do the same.

Double click to run Xcode, it will warn you that it was a file download from the internet and ask you if you wish to open it. It will also ask you for your admintrator password as some things need to be registered with the system.
When this is completed then you should see the Welcome to Xcode dialog.

The first thing you should do is go to the Xcode Preferences (cmd+,) in the menu bar at the top and click downloads. as there maybe addition components or updates to install.

The next thing is to go to Organiser (shift+cmd+2) found in Xcode’s application menu bar under Window.
Click Devices icon to list the current Devices this will list what devices are currently registered. On a clean install of OS X and Xcode you should only see your Mac computer. If you have connected a iPhone etc you may see this as well. When you click the My Mac device in the list you will see a button that says Enable Developer Mode and underneath a description of what it does. You can build Monkey applications without enabling this but at some point you will have to use Xcode and it's tools directly. You will require a administrator password to enable developer mode.

You can now quit Xcode.
------------------------------------------------------------------------------------------------------------------------------------------------

Installing Monkey-X
Using MonkeyPro77f

The only place to get Monkey-X is to download it from the Monkey-X web site
http://www.monkey-x.com

After you have downloaded the Monkey-X zip file; extract it and move the Monkey-X directory to a location of your choice.

As Monkey-X was not distributed via the Apple Store, just clicking the Monkey icon will not work unless you have gone into the system preferences and change this action via Security & Privacy to “Anywhere".

The other way is to get it to run is a three stage process as you have to right click the main Monkey application and select open in the context menu. Then you need to do the same for Ted that is found in the bin directory. Within the bin directory is an application called mserver_macos, so you should do the same for is application as this application is a minimal server for use with HTML5 builds, it will ask you if you wish to allow or deny access for network communication so you should allow it.

When you first run Monkey you will have these targets available
C++ Tool (don't think this is available on the free version)
Desktop Game
HTML5 Game
iOS Game (note this is only available with the Monkey-X Pro version)

The other targets which are only available in the Monkey-X Pro version after the relevant SDK and tools installed are
Flash Game
Android Game
Android (OUYA) Game

When adding other target SDK's. You will have to edit the path variables in the Monkey-X config.macosx.txt file to where they are located.
NOTE: There are special variables in the path that are used as abbreviations. These are
${MONKEYDIR} Location of the Monkey.app
${HOME} Location of the current users home directory

To develop a application for an iOS device or to distribute via the Apple AppStore you need to have signed up to the relevant developer program.
https://developer.apple.com/programs/

Note: Sometimes the Xcode project file will need to be updated when a new version of Xcode is released. This becomes apparent when compilation fails. To solve this issue you can either open the Xcode project files in Monkey-X templates (Xcode templates can be found in MonkeyX[Pro]XXX->targets->ios->template or Monkey[Pro]XXX->targets->glfw->template->Xcode) or open the Xcode project files in the .build directory.
select from the Xcode application menubar Edit->Validate Settings. This will update the Xcode project file.
------------------------------------------------------------------------------------------------------------------------------------------------

Installing Java and the JDK (need for both flash and android targets)
Current version 7 update 51 as of Feb 2014
Files jre-7u51-macosx-x64.dmg and jdk-7u51-macosx-x64.dmg

Download both the JRE and the JDK disk image files .dmg from the Oracle web site. You must accept the license agreement before you can download.
http://www.oracle.com/technetwork/java/javase/downloads/index.html

Double click the JRE disk image first and then double click the open-box icon to install. Click the install button and enter the administrator password when prompted. After installation Safari will open to Oracle's Java installation test page. Click the red Verify Java Version button and when prompted to run Java Detection, click the Run button.

Do the same now for JDK disk image. The installation is the same, but without Safari doing the checking.
To check that the JDK is successfully installed you need to do it from the command line.
You will find the program called "Terminal" in "Applications->Utilities". This is what is used for anything that require command lines.

In this terminal type:
java -version

You should see something like the message below if all has gone well.
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

Note: The JDK is not updated automatically and I would highly recomend that you keep the JDK up to date to avoid Java runtime clashes and possible security issues.

Some important information about Apple Java 6 Plugin
http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-preferences.html
Some import information on installation and removal of JDK's http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html
Some information on ire installation and removal.
http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jre.html
http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-install-faq.html
------------------------------------------------------------------------------------------------------------------------------------------------

Installing Android SDK (needs ANT and JDK to work)
Current version r22.3 as of Feb 2014
https://developer.android.com/sdk/index.html

On the download web page you can either click USE AN EXISTING IDE or DOWNLOAD FOR OTHER PLATFORMS. In the other platforms section you need the Platform Mac OS X 32 & 64-bit Platform in SDK Tools Only, which is what gets downloaded when you click USE AN EXISTING IDE.

After it has download, extract the archive and move the android-sdk-macosx directory to a location of your choice.
You will then need to run the android sdk manager (named android) that is found in android-sdk-maxosx/tools.
When this is executed it will warn you that this is a file download from the internet and would you like to proceed with execution. It will then open a console window and then the Android SDK Manager.

In the Packages lists add the Android 3.2 (API 13) package by clicking the check box and then click the Install packages button. It asks you to accept the licenses and will then download the actual Android SDK files.

Once this task is complete you can close the two windows that were opened. You must then open the file config.macosx.txt and add/modify the ANDROID_PATH variable with path to the android-sdk-macosx directory. I recommend that you use the Monkey-X IDE to open the config file and switch the file filter to All Files so you can select it, unless you have turned of smart quotes and dashes in the OS X default text editor. If you don't turn these features off you will mess up the config file.

Installing the NDK (optional and subject to change as there is little information for the NDK and Monkey-X)
Current Version r9c as of Feb 2014
https://developer.android.com/tools/sdk/ndk/index.html

There is a 32bit and a 64bit download for the NDK. Download the one for your OS and CPU architecture?
After downloading, extract the archive and move the extracted NDK directory to a location of your choice.

You must then open the file config.macosx.txt and add/modify the ANDROID_NDK_PATH variable with path to the android-ndk directory. I recommend that you use the Monkey-X IDE to open the config file and switch the file filter to All Files so you can select it, unless you have turned of smart quotes and dashes in the OS X default text editor. If you don't turn these features off you will mess up the config file.
------------------------------------------------------------------------------------------------------------------------------------------------

Installing ANT
Current version 1.9.3 as of Feb 2014
http://ant.apache.org/bindownload.cgi

Download the latest release and extract it. You can then move the extracted ant directory to a location of your choice. You must then open the file config.macosx.txt and add/modify the ANT_PATH variable with path to the ant directory. I recommend that you use the Monkey-X IDE to open the config file and switch the file filter to All Files so you can select it, unless you have turned of smart quotes and dashes in the OS X default text editor. If you don't turn these features off you will mess up the config file.
------------------------------------------------------------------------------------------------------------------------------------------------

Installing Flex (needs JDK to work)
Current version 4.11.0 as of Feb 2014
http://flex.apache.org/installer.html

Recommend installing Adobe Flash Player
http://get.adobe.com/flashplayer/

The easiest method to install the flex sdk is to use the installer. After downloading open the disk image file (.dmg) and double click the Install Apache Flex SDK Installer. After the application download from the internet warning dialog; the first dialog of the Installer asks where you would like to install the installation tool for use later. Accept the defaults and click continue. The Installer it's self will start, again you will get the application download from the internet warning.

The Flex installer will allow you to select which version of the Flex SDK, Adobe AIR and Flash Player to install. Accept the default and click NEXT.

The next dialog is where you wish to install the SDK, click browse and make a new directory and name it for example flex_sdk_4.11.0. After clicking open you will now be able to click the NEXT button.

In the next dialog select all the packages with the required tags. And click NEXT to begin downloading the files.
NOTE: If you wish to install the same version of the Flex SDK, then you will have to delete the directory or make another.

You must then open the file config.macosx.txt and add/modify the FLEX_PATH variable with path to the android-ndk directory. I recommend that you use the Monkey-X IDE to open the config file and switch the file filter to All Files so you can select it, unless you have turned of smart quotes and dashes in the OS X default text editor. If you don't turn these features off you will mess up the config file.

Optional Stand Alone Flash Player.
http://www.adobe.com/support/flashplayer/downloads.html

Download the Flash Player Projector disk image (.dmg). Open Finder and then open the disk image.
Drag the Flash Plash Player application icon from the disk image window to the application folder in finder.

You must then open the file config.macosx.txt and add
FLASH_PLAYER="/Applications/Flash Player.app/Contents/MacOS/Flash Player"

I recommend that you use the Monkey-X IDE to open the config file and switch the file filter to All Files so you can select it, unless you have turned of smart quotes and dashes in the OS X default text editor. If you don't turn these features off you will mess up the config file.


Boulderdash(Posted 2014) [#3]
thanks, where is the "home" directory and how do I access it ?


computercoder(Posted 2014) [#4]
The "home" folder is the folder that has your name or what you use to login to your Mac with. To locate it:

- Open Finder
- Look under the "Favorites" section on the left
- Look for the folder with a picture of a house to the left of it. This is your "home" folder.


Boulderdash(Posted 2014) [#5]
Thanks computercoder ; I can not see a picture of a house under Finder/Favourites but I was able to google another way of finding it, that is ; Open Finder then click on "go" (at top) then I can see "home" folder there only ?

Once I found it , I was able to drag it to favourites


As you may be able to tell I have never used a Mac before, I have never been able to afford one LOL ! I have been stuck with a poor mans OS for years (Windows) !


computercoder(Posted 2014) [#6]
No problem :)

You can go into the system preferences (Click on the Apple icon in the menu bar, then select Preferences) and from there you will have what is basically equivalent to the Control Panel in Windows. You can set all the defaults and behaviors of your system there.

Here is a link to help you navigate your Mac :)

http://guides.macrumors.com/Mac_Beginner's_Guide

I hope you enjoy your Mac :)


Boulderdash(Posted 2014) [#7]
I am enjoying it, I'm enjoying no more LAG !!! and zippy internet experience, no time to catch a nap between tasks anymore etc etc etc...

Thanks for the tip about using Monkey IDE for editing config file, my Mac was messing up the text file and preventing it from working. It would be nice if these settings could be changed via a dialog window.

Success, I now have Monkey working on My Windows Laptop and my Mac Book.

Cool Banana's (so old but relevant to Monkey's) hehe.


dawlane(Posted 2014) [#8]
It would be nice if these settings could be changed via a dialog window.
Turn off smart quotes.
http://scttdvd.com/post/65242711516/how-to-get-rid-of-smart-quotes-osx-mavericks
For some unknown reason in smart quotes and tabs is on by default. I suggest that you should check your settings in your firewall as well as ome features are not enabled by default.