Knowledge Base/GameMaker: Studio/Android

GameMaker: Studio Android (SDK and NDK setup)

James Foreman
posted this on March 14, 2013, 13:41

Before actually starting to work with GameMaker:Studio and Android, it is worth noting that Android devices vary immensely in capability. The GameMaker:Studio runner will only work with Android 2.2 and above, which covers the majority of devices around at the moment but not all of them, so please check and make sure which version of Android your device uses. It is also recommended that your device have a dedicated GPU with Open GL version 1.1 or above. Devices without a GPU will still run your GameMaker:Studio projects, but expect them to have severe drop in performance.

Getting Started

Setting up GameMaker:Studio so that it works easily with Android devices can be a tricky procedure. To that end we have outlined every step in this process so that it can be done as quickly and painlessly as possible.

Android SDK Setup

To start working with your Android devices and GameMaker:Studio you will need to download and install the Android SDK as well as the Android NDK (which is required for the YYC to work). Here we outline the step-by-step process of going about this and getting everything setup correctly.

Install Java JDK

If you do not have the Java SE Development Kit (JDK) installed already, you will need this when installing the Android SDK, so please install this now at the page http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html - please note that the Android SDK wants you to use the X86 (32bit) JDK regardless of if your copy of Windows is 64bit, so ensure you get:

 Windows x86 127.8 MB    jdk-7u79-windows-i586.exe

 

Install the Android SDK

First you should go to http://developer.android.com/sdk/index.html#Other and download the Android SDK. We recommend always using the latest version .exe. Please note: higher up on this page you will be presented with the option of downloading the ADT Bundle for Windows, but this is not recommended, as it is a pre-prepared development bundle that comes with Eclipse and alternative configuration tools which will not be covered here. 

  1. Run the Android SDK installer. You will be asked to install the Android SDK to the path "C:\Program Files (x86)\Android\android-sdk". We strongly recommend that you choose somethign with no spaces in the path, such as C:\android-sdk\, as the default path can cause problems with the actual Android updater program itself.
  2. Once you have successfully installed the Android SDK you will be given the option to start the Android SDK Manager. This you must do, as it will install additional tools and device specific functions. When it starts you should select only Android SDK Platform ToolsAndroid 2.2 (API 8)Android 3.2 (API 13), Android 4.0.3 (API 15), as well as the most recent version of Android (selected automatically by default by the manager). Please don't just select everything to be installed, as this will a) needlessly waste your bandwidth and HDD space, and b) might cause conflict errors during builds.
  3. It should be noted that after installing these files the Android Download Manager may inform you that there are other files to be installed and that you should close and relaunch the SDK Manager, so please do this if asked..
  4. It is advised to check the revision details and see if you don't already have the selected update installed. For more information on this process and the Download Manager See Here.
  5. You should also set the PATH variable to allow you to run the command line tools (more information here).

Your Android SDK Manager should look something like this: 

AndroidSDK.png

Install the Android NDK

You should proceed to download the Android NDK as well. Note that with recent releases of Studio we support 10b only, as platform submission requirements dictate the version to be used. Forthcoming releases starting with the March/April EA release will suport 10d and future versions.

Version 10b, however, shipped with 32bit and 64bit "platform target" versions, so it's important that you install the correct package. Please note that it is the 32bit target version of the NDK you need - if you get the 64bit target version you won't have the correct files required and you will receive compiler errors that files cannot be found. The direct links to the correct versions are:

Windows 32bit
http://dl.google.com/android/ndk/android-ndk32-r10b-windows-x86.zip

Windows 64bit
http://dl.google.com/android/ndk/android-ndk32-r10b-windows-x86_64.zip

The installation is simple and straightforward (again, we would recommend you modify the install location to be a simple path such as "C:\android-ndk\") and once finished you can then continue on to start using GameMaker: Studio.

GameMaker:Studio Basic Setup

Once you have correctly installed the Android tools and are ready to proceed, you must then install GameMaker:Studio and do the following :

  1. Launch GameMaker:Studio
  2. Enter your License Key
  3. Create a new Project
  4. Select File>Preferences>Web Server
  5. Web Server Port: This is set to 51268 to 51280 by default. There is no need to change this unless these ports are already in use
  6. IP Allowed List: Enter your local IP address range in the format xxx.xxx.xxx.0/24 as seen in this example: 192.168.1.0/24

If you are not sure of your local IP address, you can find it easily by following the instructions found here

We recommend a direct USB connection from your PC to your phone/tablet, but please note that if you are using wifi to talk to your device, the device must be on the same wifi network as your PC.

Device Setup For Android

It is essential that the Android device (or devices) you are using with GameMaker:Studio are configured to work properly with the software. Below are the steps to follow to ensure that there are no problems.

Enable USB Debugging

  1. On your Android device, browse to Settings>Applications>Development and enable USB Debugging

Connecting Your Device

  1. Connect your Android device to your PC via the data cable
  2. The device drivers should be installed automatically at this stage (if they aren't already), but if they are not, then please refer to your device manufacturer's support information to locate and install the correct ADB drivers. It is very important you get ADB drivers, not the standard consumer ones.
  3. Now test your phone driver to confirm if it's correct. Follow the appropriate 
    • If you have already set up the PATH variable as mentioned above, simply Windows Key and R to open a new Run window and type "cmd" (no quotes) and hit enter, then type "adb devices"
    • Go to your Android install folder and then the "platform-tools" folder inside it (e.g., C:\android-sdk\platform-tools) and then hold down the shift key and then right-click in some empty space and choose "Open a command window here". In the new command window, type "adb devices" (without the quotes). 

Preparing GameMaker: Studio

There is one more very important step to be taken before you can start to create games for Android with GameMaker: Studio, and that is to set up the preferences, which can be found in File>Preferences>Android. Before continuing please make sure your Android device is connected and that you have followed the steps outlined in Device Setup For Android (above).

AndroidPreferences.png

If all has gone correctly, the first three sections should have been filled in automatically by GameMaker:Studio (if not, please refer to the section on Troubleshooting, below), which only leaves you to Create the Private KeyStore from the Keystore Tab.

Android_Prefs.png

The KeyStore is a file that will be used to "sign" all your Android apps so please fill in all the details correctly and then back this file up!

  1. Name - this is the filename of the KeyStore (note : Not your name or the company name!)
  2. Password - your security password for the KeyStore file which must be at least six characters long.
  3. Alias - this is the name of the "user" for this keystore and can differ from the Name field above.
  4. Password - the same password as written in the Password field two above. This is a long-time Android SDK bug.

The right-hand side is optional and has no relation inside GameMaker: Studio, but we'd recommend you fill them in anyway.

  1. Common Name - this would normally be your name
  2. Organisational Unit - the department within the company that you are in
  3. Organisation - the name of your company
  4. Location - the name of the town or city where you are based
  5. Country - the two letter code for the country where you are based

Note that all names must have only letters, numbers and spaces but no special characters.

Once this information is filled in and you are happy with it, press the button marked "Generate" for GameMaker:Studio to create the necessary KeyStore file. This may take a moment, but once it is finished you will see that the section marked Private KeyStore File will have been updated to reflect the new name that you have given it. Once this is done it normally will not need to be changed again.

Again, please back up your keystore file somewhere safe and make sure to remember your details - we recommend takign a screenshot with the passwords showing and then back this file up along with your keystore. You can find the generated keystore at the path you have in the top field of this preferences form.

If you lose your keystore or forget the alias/password details you will not be able to perform updates on Google Play apps that have already been published!

Running A Game From GM:Studio On Your Android Device

Once you have set up both GameMaker:Studio and your Android device, it's very simple to get your games up and running. The first thing you must do is in GameMaker: Studio go to the target dropdown dialogue in the main window and select "Android". Now, the next step depends on whether you have your device connected via data cable or via WiFi. Below are the steps to follow in either case :

Run On A Connected Device

  1. Make sure your device is connected to your pc through its USB data cable and that you have followed the device setup advice.
  2. Click the Green play button at the top of the main GameMaker: Studio window to compile your game
  3. As soon the compiling is complete, your game should appear on the device as designed.

Run On A WiFi Device

Before you can use the WiFi setup, you need to make sure that the device to be tested has the YoYo Games runner installed. This can only be achieved through a data cable connection. This means that you must follow the connected device steps at least once before WiFi connections will work, as this is currently the easiest way to install the runner on the device (you can use Dropbox folders and double-click the runner .pkg on your phone, etc.).

Once the runner is installed on your phone, follow the steps below :

  1. Make sure that you have correctly configured GameMaker: Studio (see GameMaker: Studio Basic Setup for more details)
  2. Click the Green play button at the top of the main GameMaker:Studio window to compile your game
  3. When compiled, tap the YoYo Games Runner on the device and you will get the "connecting" window. Your game will now run as normal, unless this is the first time you are running the WiFi mode, in which case you should also follow the next steps too.
  4. When the YoYo Games Runner starts up there is button marked Settings. Tap that button to open a new screen with two further options.
  5. You should set the GM:Studio IP Address to the one that your computer is currently using. If your network supports name resolution you can use the PC's name and avoid issues with the IP changing later.
  6. You should set the GM:Studio Port Number to match the one that you setup in GamneMaker: Studio Basic Setup (51268 by default)

The game should now connect and run automatically every time that you press the green "play" button on GameMaker:Studio.

 
Topic is closed for comments