Setup GameMaker:Studio for Android

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.1 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. Here we outline the step-by-step process of going about this and getting everything setup correctly.

 Install The Android SDK 
 * 1) Go to http://developer.android.com/sdk/index.html and download the Android SDK (we recommend always using the latest version .exe).
 * 2) Run the Android SDK installer. If you do not have the Java SE Development Kit (JDK) you will also be prompted to download and install this before continuing. 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 an alternative path (for example : "C:\Android\android-sdk") as the default path can cause problems with GameMaker:Studio as well as the actual Android updater program itself.
 * 3) 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 Android SDK Platform Tools, Android 2.1 (API 7), Android 2.2 (API 8), Android 3.0 (API 11), as well as the most recent version of Android (selected automatically by default by the manager). It should be noted that after installing these files the Android Download Manager may inform you that there are other files to be installed, but this may not always be the case! 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.
 * 4) Take some time to get to know the Android SDK and read all the included documentation and it is recommended (but not necessary) that you also set the PATH variable to allow you to run the command line tools (more information here).

GameMaker:Studio Basic Setup
Once you have correctly installed the Android SDK 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 here as seen in this example: 192.168.1.1/24

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

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 drivers

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.



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 Troubleshooting, below), which only leaves the final section Create Private KeyStore for you to fill in. The KeyStore is a file that will be used to "sign" all your Android apps so please fill in all the details correctly.


 * 1) Name - this is the name of the KeyStore file (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 another name that can be used for the KeyStore file and should be different to the above name
 * 4) Password - the password for the alias file. Should be different to the Name password and be at least six characters long
 * 5) Common Name - this would normally be your name
 * 6) Organisational Unit - the department within the company that you are in
 * 7) Organisation - the name of your company
 * 8) Location - the name of the town or city where you are based
 * 9) 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.

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 once there 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 here
 * 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 above steps at least once before WiFi connections will work as this is currently the only way to install the runner on the device. Once that is done, 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 using (the same as this step)
 * 6) You should set the GM:Studio Port Number to the one that you setup here (51268 by default)

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

Troubleshooting
Due to the fact that Android versions differ greatly from device to device and the fact that no two pc's are the same, it's unfortunately inevitable that some problems could occur with this process. Here are a few hints and tips that should help troubleshoot the majority of those problems :

Studio can't place the YoYo Runner on my Device
If you find that the runner is not transferred to your device the first time you plug it in and run a game through GameMaker:Studio, this means that the Android Debugger (adb) is not working as it should. Your priority here is to get it to work! One of the main issues is that not all device drivers are installed with adb and so you should consult your manufacturer to get the latest drivers for your specific device. Here are some links to the major manufacturers :


 * Samsung
 * Motorola
 * HTC
 * Sony Ericsson

Is the device connected?
if you have updated the drivers and still can't get things to work as they should, then it's often useful to know if the device is actually recognized and connected. To do this, follow these steps :
 * 1) Plug the device into the computer using the USB data cable
 * 2) On your PC, Press and hold the Windows Key and hit R to open the Run dialog
 * 3) Type in CMD and hit enter to open a command prompt
 * 4) Go to the directory where you installed Android and type "cd platform-tools" and press enter
 * 5) Now type "adb get-state"

If all goes well, you should get the message "device", signaling that your device has been recognized and all is well. However, if you get the message "unknown" this means that your device is not recognized. In this case you may have to install the drivers specific to your device.

How to install the YoYo Runner without GameMaker:Studio?
If the Android Debugger (adb) detects that your device is connected, but the device still does not respond to GameMaker:Studio creating a game, you may need to install the YoYo Runner onto the device manually. This can be done as follows.


 * 1) On your PC, Press and hold the Windows Key and hit R to open the Run dialog
 * 2) Type in CMD and hit enter to open a command prompt
 * 3) Go to the directory where you installed Android and type "cd platform-tools" and press enter
 * 4) Type the following into the command line, ensuring to replace the file location to your own install location: adb install %AppData%\GameMaker-Studio\Android\com.yoyogames.runner.apk
 * 5) Hit Enter and wait for install to complete (will state "Success" on completion)
 * 6) Once installed, you should now see the YoYo Runner application on your Android Device

How to use Dropbox to run your game
Another way to get your game onto your Android device without using the data cable is to use DropBox. Download their app from the Android Market and install it on your device, then save the game apk created by GameMaker:Studio to your DropBox account. Once that's done and your device is synced to the DropBox account, just run the apk from your device.

Nothing Works!
If you have tried all of the above, you should go back to the start of this document and make sure that you have done everything as stated, and that your device meets the minimum requirements necessary. Revise and make sure that the IP address, the ports and all other information is correct within GameMaker:Studio and that your installation of the Android SDK is correct to. Take a moment to read the other troubleshooting tips too as it may be something a simple as out of date drivers that are the problem.