-
Notifications
You must be signed in to change notification settings - Fork 10
Android GMS2
After installing GameMaker you can build projects for Android (which also supports Amazon Fire devices and your games can be released on various manufacturer-specific stores, not just Google Play Store and Amazon).
If you open Target Manager by clicking the "target" button in the top right of the main window, you will see there are two output options:
-
VM- slower in-game performance, but quick to build each time and supports debugger builds -
YYC- faster in-game performance, especially with logic-heavy games, but much slower to build each time and does not allow debugger builds
Regardless of the output that you select, you will need to add some extra build tools to your development computer before you can continue. In this article we give the required steps to set everything up.
Caution
You must always use the specific version(s) advised in the table below and do not assume newer tools than we list here "will be even better", as using newer SDK versions than GameMaker supports will quite possibly introduce build failures you could have easily avoided if you had followed this guide correctly.
Android Studio:
Android Studio "Koala Feature Drop 2024.1.2 (Patch 1)" (if required, you can use the Android Studio downloads archive to get this)
Inside Android Studio:
| Android SDK Tab Name | Packages You Need |
|---|---|
| SDK Platforms | * API 35's one item for "Android SDK Platform 35" (you don't need all the rest of the API 35 section) |
| SDK Tools | * "Android SDK Build-Tools 34.0.0" (Gradle 8.5 requires 34 and does not support 35) * "NDK 27.0.12077973" * "Android SDK Platform-Tools 35.0.2" or newer (if fresh-installing you will get 36 automatically) |
Do not install Android beta versions which have any "-rc" suffix.
Gradle Plugin:
Requires Gradle Plugin version 8.5 specifically.
Android's build tools should install this automatically for you the first time you do a build inside this version of GameMaker, but should you need to download it manually you can do so using the link above.
Java JDK:
You do not need to install Oracle's JDK separately, as Android Studio installs OpenJDK for you, so please don't grab the latest version of Oracle Java "just because". Also, Oracle changed their licence for Java several years ago such that you may legally need to pay them for any commercial app-development usage, so it's best to avoid that and stick with Google's installation...
Emulator support using AVD is entirely optional and requires quite a bit of disk space, so if you know you won't use emulators, then we recommended you deselect this and save the space. Be aware we only offer support for issues found when running on physical devices.
Choose where you want it to install and whether to create shortcuts or not (GameMaker never requires you to use Android Studio for anything other than occasionally managing your SDK installation).
Allow the installer to finish, and then Android Studio will start at the end of the installer.
If you are a new Android user, then the first screen will advise you no SDK installation can be found (which is correct, as you haven't installed it yet...). Click "Next" and then you will be asked which components you want to install and where.
Caution
For the "Android SDK Location" value, Google's path names can get very long and go beyond Window's path length limit of 256 characters, which will cause your builds to fail. Always install as close to the root folder of your drive as possible AND do not use any whitespace. Windows IDE Users: We generally use "C:\AndroidSDK" on our machines, but you can install the SDK onto a different drive if you wish. Mac and Ubuntu IDE Users: We use "~/AndroidSDK/" on our machines.
Note that you cannot just edit the path via the text field - you have to click the little folder button on the right and navigate through to your desired location (creating the folder, if required).
Once you have set the shorter SDK install path, click Next, accept the components list and the licences for those components, and click Finish.
Finally, once your chosen components are downloaded and installed, Android Studio will then shortly start up.
When Android Studio appears it may have an update notification already waiting. Ignore any update prompts, as we will install the packages we need as we go through this guide.
Click the SDK Manager option on the front screen to begin installing your tools:
This will open a new window where you can select and install the SDK platforms that you require.
Before you go any further, tick both of the checkboxes for Hide Obsolete Packages and Show Package Details - as you do not need to download everything for an API to make it work with GameMaker and similarly later on in this guide we will want to pick specific tools versions, which may not be the newest versions listed.
See the Required Tools Versions table for which specific packages you need to select now.
Be aware that Android Studio's installer will have already selected the latest available non-Beta "Android SDK Build Tools" (which is fine, but ensure you also/instead have the one we said in the table above) and the latest available version of Android SDK Platform Tools (which is fine and you can't modify anyway).
With that done, click the Apply button at the bottom of SDK Manager, confirm the changes, and then wait for the download process to finish.
You are now ready to go and set up GameMaker for Android development. You can close SDK Manager and indeed Android Studio, as these do not need to be running whilst you work in GameMaker.
Note that (apart from the NDK installation) if you did not install everything you require in SDK Manager, whenever you next attempt an Android build inside GameMaker, Android's own tools will try to "repair your install" by downloading the missing bits during the build process - this is fine, allow this!
The values you have chosen inside Game Options will affect which packages are downloaded.
Similarly, be aware by default Gradle will assume/require an internet connection and will perform an update check and download any required components you do not have installed at the start of each GameMaker project build. We would recommend you leave this enabled, but if required you can disable this within Android Studio: https://developer.android.com/studio/intro/studio-config#offline
Of course, if you have a firewall or you use your computer offline often and you start seeing projects fail to build, before you report any bugs make sure you have the tools versions we say in the table at the top and you have downloaded any missing components manually and confirmed if this fixes your issue.
When you now return to GameMaker, you need to set your values in Preferences > Platform Settings > Android.
| Preference | What You Set It To |
|---|---|
| Android SDK Location | Type in or select wherever you installed your SDK within Android Studio. Assuming you did use the values we recommended earlier as your SDK installation path, this would mean something like: * Windows: C:\AndroidSDK\ * macOS: /Users/[your macOS username]/AndroidSDK/ If you chose a different install location earlier and now want to change this so yours matches our recommendations, or you just need a reminder, you can do this back on the SDK Manager screen in Android Studio. |
| Android NDK Location | Android Studio always installs your NDK into a subfolder of the SDK install location, so use the file-picker button to find this folder now. Assuming you did use the values we recommended, this would mean something like: * Windows: C:\AndroidSDK\ndk[version number]\ * macOS: /Users/[your macOS username]/AndroidSDK/ndk/[version number]/ |
| Java JDK Location | Android Studio comes with its own version of OpenJDK, which is the only version of JDK Google's build tools actually supports, so use the file-picker button to find this folder now. Again, the default paths Android Studio's installer recommendeds will see your JDK installed to: * Windows: C:\Program Files\Android\Android Studio\jbr * macOS: /Applications/Android Studio.app/Contents/jbr/jdk/Contents/Home |
Now you can scroll down and create your Keystore file. This is a file that will be used to codesign all your Android apps, so please fill in all the details correctly and then back this file up along with a screenshot or other record of your username and passwords! We recommend you create a single keystore file for your organisation and use this same file for all your projects, rather than generating separate keystores for each project.
When creating a new keystore file, you are required to give the following details:
| Preference | What You Set It To |
|---|---|
| File Name | The default shows you where to find the file once it has been made (you need to change this if importing your existing keystore file) |
| Password | The password you want to use for the keystore file itself, 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 |
| Alias Password | Needs to be the same password as the one above, as this is what Google's tools require |
| Common Name | This would normally be your own full name or some other identifier for you |
| Organisational Unit | The department within the company that you are in (Optional) |
| Organisation | The name of your company (Optional) |
| Location | The name of the town or city where you are based (Optional) |
| Country | The two letter code for the country where you are based (Optional) |
Note that all names must have only letters, numbers and spaces - no other "special" characters!
Once this information is filled in and you are happy with it, press the button marked Generate Keystore for GameMaker to create the necessary file. This may take a moment and then you should see the key hash fields are filled-in automatically. You can now Apply/OK and you're done.
If you have an existing Keystore file, then simply point GameMaker to the file and fill in the details in the required list above exactly as they were when you first generated it.
Do not click the Generate Keystore button, as that would overwrite your file! Instead, click the Show Key Hash button to confirm your user/password details work, then click Apply/OK to close Preferences.
Tip
The specification for a keystore file does allow you to have multiple users ("aliases") in a single keystore file. GameMaker doesn't provide for creating keystores in this fashion, but if you import a keystore which already has multiple aliases in it, then you just supply the master password and the details for the one alias you wish to use.
Inside Target Manager there is a column marked Devices and this has a small pencil button at the top. Clicking this button opens Device Manager on its Android page, where you can add your device(s) to deploy to when building your projects.
For GameMaker to detect your device it must be plugged into the computer using a USB cable and must have Developer Mode and USB Debugging enabled. On Mac you will also need to have installed the Android File Transfer App.
Important
Once "Developer Mode" and "USB Debugging" are enabled on your device, enable the "Install via USB" option as well while you're on the correct screen
Once the device is connected and unlocked for developer use, clicking the Detect Device button should automatically detect it and add it to the list of connected devices.
With that done you can then click the Test Connection button, and if the Android device is visible and correctly connected via USB then it should say "Connection Successful!"
Tip
If you have any trouble with GameMaker finding your device(s), please see the Helpdesk article on Android Troubleshooting.
Before you can test your Android games you need to set some things in Game Options > Android, so open that now.
Here, GameMaker gives you a dropdown to selectively target a specific version of Android. For a project that has no extensions or extra requirements you would simply pick the newest API Level you have installed. (Note that this dropdown will show all APIs you have installed, so do pick carefully if you have installed more versions than just the one we said in the Required Tools Version table.)
Should you need to customise any of the other fields, always refer to what you have actually installed in Android Studio and get the version numbers from there; however, we will now briefly explain a few of these fields and their default values.
| Game Option | What You Set It To |
|---|---|
| Build Tools | If you chose API 30 or above in the top dropdown you will see this value is left blank because Google have changed this so you specify the Compile SDK value and the Android SDK works out the correct build tools you need. If you're compiling with API 30+, then any version you type here will be ignored by Google's tools, and if you are targeting an Android API below 30 then a suitable build tools value will be set for you by GameMaker. |
| Compile SDK | This is the version of the API that the project is compiled against. This means you can use Android API features included in that version of the API - e.g., if you try and use API 28 features in your game but only set Compile SDK to 26, then you will get a compilation error. Note that if you set a recent version you can usually still run the app on an older API device. |
| Target SDK | This actually has nothing to do with how your app is compiled or which API(s) you can utilise - instead, it indicates that you have tested your app on (up to and including) the version you specify. This is simply to give the Android OS an idea of how it should handle your app in terms of OS features. For all practical purposes, most apps are going to want to set Target SDK to the latest released version of the API (as used by the Compile SDK setting). This will ensure your app works as well as possible on the most recent Android devices. |
| Minimum SDK | The minimum API level that will run your project. The default value GameMaker sets will generally be fine, but if you add extensions, then they may require a higher minimum API level and so you would need to raise the value here. (Your build would fail with a suitable error message telling you that a certain number is required.) |
You don't need to give any further information here while you are just testing your projects, so you can close Game Options now.
Once the above sections are completed and you have a project ready for testing, you can open Target Manager and select the Target, Output and Device options that you want to use. You can then click the Run button on the menubar to compile the project and push it to your test device.
If all goes well, you should soon see your game project running on your target device!
Tip
If any build ever fails, please read ALL of the Output Window log to determine why the build failed - do not only look at the two lines at the end, as you're missing the important information which will help you fix the issue right away!
Once you have finished testing and are happy with the project, then you'll want to look at creating a final executable package and publishing it to a store. This process is explained in the following Helpdesk article: