For setting up GameMaker Studio 2 Android please see here.
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.3 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.
To start working with your Android devices and GameMaker: Studio 1.4 you will need to download and install the following development kits:
- Android SDK
- Android NDK
- Java SE Development Kit (JDK)
These kits will be used when testing and building your project for Android. Note that the exact versions required for each (along with links for downloading them) can be found from the article:
Note that whenever possible you should stick to the versions we specify in that FAQ, as newer versions may be unsupported. Google do update the SDK/NDK pretty frequently, so be careful just grabbing the latest stuff.
Set Up the Android SDK and NDK
When using GameMaker: Studio 1.4 on a Windows PC, you have two options for installing the SDK components, either use Android Studio (recommended) or download the Command Line Tools. If you have an existing command line installation from using GM: S 1.4, then this is fine to carry on with - although GMS2 does currently target newer SDKs than 1.4 does, so there's maybe a bit of updating your SDK to be done.
Here we outline both methods and you should only pick one for your Windows machine - don't install the tools twice.
Using Android Studio
You can get Android Studio from the following link, and once downloaded you need to install it on your PC:
When installing Android Studio, you can choose either the Default install or the Custom install. We recommend the custom install as it gives you the option to get the Android NDK and setup your computer to use Virtual Devices as well (you need to select them from the custom install screen shown below):
If you choose the Default install, then you will need to later add the NDK if you wish to compile using the YYC runtime and you'll need to later add the Virtual Device components from the SDK Tools and AVD Manager if you wish to make use of the Android Emulator instead of (or as well as) a physical Android device.
Regardless of the install type, once it has installed you need to run Android Studio and on the Splash Screen, go to the menu labelled "Configure", and in the drop down menu select the SDK Manager.
This will open the following window where you can select and install the platform SDKs that you require (in general you simply need the latest SDK but you can install any, or all, of those on the list, as long as you ensure you use the correct SDK values later in GameMaker: Studio 1.4):
You can see in the image above that we have also highlighted the Android SDK Location. You should take note of this as you'll need it later in the GameMaker: Studio 1.4 Preferences. Once you have downloaded the required platform SDKs, you need to click on the SDK Tools tab and then download and install the following (select each of them from the list then click Apply to download them - note that you may need to accept licence agreements before the download begins):
IMPORTANT! Make sure to take note of the Build Tools Version number as well that of the API installed, as you will need these later in GameMaker: Studio 1.4.
Note that the above image shows the Android NDK selected too. This is required if you wish to use the YYC runtime to create your project APK, but for regular VM compilation this is not necessary (if you have performed a custom Android Studio install then this should already be added and installed).
You can also choose to install all the extras with Google in them now, although this is not essential for basic Android development. These additional components will be used for any of the Google Play services, or for Ads or In App Purchases, so if you require any of these features in your projects, it's best to install them sooner rather than later (you can see in the image above that the Google SDK components have been ticked too).
If you wish to target the Amazon Fire device or use any of the Amazon services in your game, you will also need to download an additional set of files from the SDK Manager. However, since these are for Amazon and not Google, you need to do it from the SDK Update Sites tab. Here you need to click the (+) at the bottom and then enter the following in the window that opens:
Name the entry something like "Amazon Fire" then click "Okay" and then in Android Studio click Apply. The SDK Update Sites tab should now look like this:
If you go back to the SDK Tools tab, you will now have new entries for Amazon Fire, and you should select these then click Apply to install the components:
With that done, you are now ready to go and set up your project in GameMaker: Studio 1.4.
Using Command Line Tools
If you do not wish to download Android Studio and would prefer to simply get the SDK on its own, then you can get it from the Android Studio page, scrolling down to the section titled "Get just the command line tools":
IMPORTANT! The command line tools are now deprecated by Google and if you don't already have a command line tools installation we recommend that you use Android Studio for all your Android SDK requirements going forward.
The Android SDK command line tools will download as a ZIP file and you should create a folder called "Android SDK" and then unzip the contents of the ZIP to that folder (so you have something like C:\Android SDK\Tools for the path).
Once you have unzipped the contents of the Android SDK tools, you need to add the required libraries to the SDK from the SDK Manager. This can be done from the command line (see here for details) or you can run the android.bat file in the Tools directory to open a command window and run the SDK Manager UI (the rest of this article will refer to this).
The SDK Manager will look like this:
To start with you can leave the Tools folder "as is" (it should have selected Android SDK Tools, Build Tools and Platform Tools), and also leave the default Android API that is to be installed (it will have checked the most up-to-date version, but you can run the SDK Manager again later and add further APIs as required). However before installing these you should also check a few things in the Extras folder, namely:
- Android Support Repository
- All Extras with "Google" in the title (Google Play Services, Google Play Billing Library, Google USB Driver, etc... see the image below for an example setup)
These are not all going to be used for a simple game on Android (except the Support Library, which is essential), but if you wish to include any type of publicity or online services then you will need them, so it's best to have them installed now to save time later.
Note that while installing the packages you may need to accept certain licence agreements and the SDK Manager may require you to restart (in which case simply close the SDK Manager and run the Android.bat file then continue).
IMPORTANT! Make sure to take note of the Build Tools Rev. (Version) number as well that of the API installed, as you will need these later in GameMaker: Studio 1.4.
If you wish to target the Amazon Fire device or use any of the Amazon services in your game, you will also need to download an additional set of file from the SDK Manager. However, since these are for Amazon and not Google, you need to do it from the Add On Sites window, which you open from the Tools menu of the SDK Manager:
In the Addons window you need to go to the tab "User Defined Sites", then click "New" and give the following URL when prompted:
The Addons window will now look like this:
When you click the "Close" button, the additional Amazon files will be downloaded by the SDK Manager for you.
The SDK command line tools do not support installing the Android NDK also, so you will need to go here and download the appropriate file:
Once you have downloaded the Android NDK you will need to unzip the contents of the ZIP file to a suitable location (for example C:/Android NDK/). It does not require any further setup and is ready for use.
Once you have the Android SDK and NDK installed, you may then have to download and install the Java JDK. By default, Android Studio comes with its own version of the JDK, which should be fine to use, but if you are using the Command Line Tools or wish to use a specific JDK version then you will need to install it separately.
You can get the JDK from the following link:
When installing a stand-alone JDK, make sure to get the one specified in the Required SDKs document.
Once you have installed the JDK and its components and have the Android SDK and NDK set up, you can continue with GameMaker: Studio 1.4...
GameMaker:Studio Basic Setup
Once you have correctly installed the Android tools and are ready to proceed, you must then install GameMaker: Studio and ensure that the web server is set up correctly to "talk" to your Android test devices:
- Launch GameMaker: Studio
- If you are a first-time user, then you will need to link your YoYo Account and licence GameMaker: Studio (see here), otherwise you will need to open a project and go to Help > Update Licence. Either way you will need to restart GameMaker: Studio for your new target module to be available.
- Create a new Project
- Select File > Preferences > Web Server
- 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.
- 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 should be on the same wifi network as your PC, although you can also configure the Android Debug Bridge (ADB) to connect to a specific IP by setting the Android preferences (see below for more details).
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
- On your Android device, browse to Settings>Applications>Development and enable USB Debugging. Later versions of Android have this option hidden away, so please check this article to find out how to enable it for your device: http://developer.android.com/tools/device.html
Connecting Your Device
- Connect your Android device to your PC via the data cable (USB)
- 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.
- Now test your phone driver to confirm if it's correct. This can be done in a couple of ways:
- If you have already set up a PATH variable to point to ADB directly (see here), then 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).
The first thing to do is go to the SDK Tab and ensure that all your SDK settings are correct and that GameMaker: Studio can access the required SDK files.
You need to make sure that the first three fields contain the correct paths to your SDK, NDK and JDK install locations, and then you should click the "Check Android SDK" and "Check Android NDK" buttons to make sure that all is working correctly. The other options here are for more advanced situations, so we won't be covering them here (check the manual for more details), but it should be noted that you can set a fixed IP address for ADB to connect to from this panel, which is useful for those devices that can't connect via USB like the Amazon Fire Stick.
Once that's all checked it's time to move on and create a Keystore file:
The thing we are going to do here is to Create the Private KeyStore from the Keystore Tab. 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!
- Name - this is the filename of the KeyStore (note : Not your name or the company name!)
- Password - your security password for the KeyStore file which must be at least six characters long.
- Alias - this is the name of the "user" for this keystore and can differ from the Name field above.
- 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.
- Common Name - this would normally be your name
- Organisational Unit - the department within the company that you are in
- Organisation - the name of your company
- Location - the name of the town or city where you are based
- 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 taking 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 or Amazon Fire 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 drop-down dialogue in the main window and select "Android" or "Android YYC" (or Amazon Fire, if you are developing for that platform).
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
- Make sure your device is connected to your pc through its USB data cable and that you have followed the device setup advice.
- Click the Green play button at the top of the main GameMaker: Studio window to compile your game
- 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 :
- Make sure that you have correctly configured GameMaker: Studio (see GameMaker: Studio Basic Setup for more details)
- Click the Green play button at the top of the main GameMaker: Studio window to compile your game
- 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.
- When the YoYo Games Runner starts up there is button marked Settings. Tap that button to open a new screen with two further options.
- 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.
- 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.