I am finishing my game so I though it is time to go out and set up my new development system. The idea is to go and make fun stuff on the Android platform! Are you with me!? Of course you are!
This post describes how to get Monkey ready for Android development. I want to mention beforehand that I am a total Java and Android development n00b, so when you read dumb stuff, tell me, ok? Thanks. Of course, there are loads of blog posts about setting up the Android SDK but these posts will be written from a former Blitz Max and new Monkey user development viewpoint.
I am using Windows 7, x64, SP1. I will be installing Monkey in D:\Monkey\MonkeyPro38, and I have a folder called D:\TargetSDK for all the SDK software. Here we go…
First, download the needed software. Here is a list of the needed components and their current version numbers:
- Monkey : Pro 3.8
- Android SDK: r10
- Java SDK, (32 bit version, even if you have a 64bit OS!!): 6u21
- Ant building tool: 1.8.2
After installing Monkey, its time to get the target platform up and running. First up is the Java SDK. Ugh, I never expected to install Java on my machine, but we need it! Start the installer. I installed the SDK in the folder D:\TargetSDK\Java\jdk1.6.0_25.
After installing the SDK, the JRE (Runtime Environment) is installed. Use the default path for this.
Next up is the Android SDK. Start the installer. I installed in the folder D:\TargetSDK\android.
If the Android installer is telling you it cannot find Java, press Back and then Next again. It will now find it. After installation, the SDK Manager will offer you a list of packages to download and install. Install the Android versions 2.1 and up.
The SDK Manager will tell you it cannot find the path to Java, so add that as suggested to your Path variable.
Next up: Create an Android Virtual Device (AVD) on which we can develop and test our programs. This is not necessary, you can put your compiled .pka on to your phone and test there, but for quicker testing this might come in handy.
It is important to remember that the next time you start the manager, make sure you start it as an Administrator.
We now install Ant. It is what builds our Android Java code. ANT comes in a zip file so extract it where you want to. I used D:\TargetSDK\apache-ant-1.8.2\
Now we must tell Trans (a Monkey component) where to look for the three SDKs we just installed. Let’s go to the monkey\bin folder and locate the file config.winnt.txt.
Create a copy of this file and then open the original.
Let’s add in the Java SDK path. We installed Java in D:\TargetSDK\Java\jdk1.6.0_25, so add the line: JDK_PATH=”D:\TargetSDK\Java\jdk1.6.0_25″
And now the Android path: ANDROID_PATH=”D:\TargetSDK\android”
Add the Ant path as well: ANT_PATH=”D:\TargetSDK\apache-ant-1.8.2″
Comment out the obsolete Ant, Java and Android paths. Save the file.
Trans should now be able to find the installed SDKs and ANT and use them to create Android .APK files. Using this setup I was able to build and run an application in the Android emulator. Huzzaa!
Some handy tips:
- The Android emulator must be running when you press that compile button otherwise the program is not installed on the device.
- NO SPACES IN YOUR PROJECT PATH AND FILENAMES. You will get an error message from Ant.
I will be diving deeper into Monkey and Android development in the coming weeks. It should be interesting.