Android: How To Add Adaptive Icons into Projects Made with GMS2 v2.1.5

Unfortunately, 2.1.5's release coincided with Google changing their submission requirements for new Google Play app submissions to require that all apps are now built targeting API 26 (Android 8.0 AKA Oreo) or above, so we were not able to add this functionality in before the release went live.

One of the sub-requirements of this change is that you need to add support for Android's adaptive icons into your projects. Please see this Google developer documentation page about adaptive icons for information on what adaptive icons are and what you can do with them.

Here's how to build these icons into your .apks using v2.1.5 - we will of course add support for doing this into Game Options > Android > Icons for the next GMS2 IDE release.

Note that you only need to do this for Google Play submissions. Amazon and other Android stores worldwide currently do not have the same requirement.

Note also that in a few months' time this requirement will apply to all updates for existing apps on Google Play also.

 

Create your Icons

You will need to create 2 new images (we'll call them adaptive_background.png and adaptive_foreground.png as an example) for each of the icon sizes currently supported by GMS2 - 36x36, 48x48, 72x72, and so on.

In the simplest example, the background image will be the icon you currently use in GMS2 and the foreground image will be used for animating over your "normal" icon, so can be simply a solid colour if you wish. (Again, see the Google document linked-to above for what you can actually do here, as it can be far more interesting than this.)

 

Add Your Icons Into GMS2's Runtime Installation

You now need to put those icons into the GMS2 build system so they can be bundled-in with your apk packages. This guide was written for the release of 2.1.5.246 - if this is not the runtime version you're building with, ensure you change the path step 1 opens below!

  1. Open the folder %ProgramData%\GameMakerStudio2\Cache\runtimes\runtime-2.1.5.246\android\runner\ProjectFiles\src\main\res
  2. Create the following new folders inside the res folder:
    drawable-hdpi-v26, drawable-ldpi-v26, drawable-mdpi-v26, drawable-xhdpi-v26, drawable-xxhdpi-v26, drawable-xxxhdpi-v26
  3. Paste your adaptive icon images into these newly-created folders (if you're unsure which folders they go into, Game Options > Android > Icons gives you the names).
  4. Using Notepad or some other text editor, create a new icon.xml file and paste in the following, then close and save the file:
    <?xml version="1.0" encoding="utf-8"?>
    <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
        <background android:drawable="@drawable/adaptive_background"/>
        <foreground android:drawable="@drawable/adaptive_foreground"/>
    </adaptive-icon>
  5. Copy & paste the xml file into each of our newly-created folders also.

 

So, 

becomes:

and each of those new folders ends up containing three files:

You should now be able to build your project and have your adaptive icons bundled-in correctly.

 

Obviously, we have just modified the runtime shared by all Android projects to contain the icons for one specific project, so if you have multiple games you need to update you will need to replace the images with the new ones for each game you want to build (you can leave the icon.xml files alone).

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.