This guide describes how to reduce the size of a game. Upon installation, a smaller game requires less time to download and less data. Both of these lead to higher install conversions. Google research shows that a 6 MB increase in served APK size results in a 1% decrease in install rate. Many developers move assets out from the APK to a content delivery network (CDN), but then incur costs both in hosting the CDN and in developing and maintaining the asset management system.
To reduce the size of a game, perform the following steps:
- Use optimized delivery methods such as App Bundles and Play Asset Delivery.
- Determine the baseline size of the game and understand its structure.
- Search for assets and other files that can be reduced in size.
- Inspect the graphics textures and identify opportunities for optimization.
- Follow the general recommendations for assets.
Use optimized delivery methods such as Android App Bundles and Play Asset Delivery
Consider the following delivery methods:
While legacy projects typically output an APK for publishing, games publishing on Google Play should use an Android App Bundle. App bundles deliver optimized APKs tailored to each user's device configuration. On average, app bundles reduce app size by 20%.
To serve game assets via Google Play and exceed the 200MB download size limit for app bundles up to multiple GBs, use Play Asset Delivery (PAD). No external CDN is required. PAD supports three distinct delivery methods, each of which can be used in a single game:
- Install-time: Download assets upon installation. Assets are packaged in asset packs, which are a replacement for Opaque Binary Blob (OBB) files.
- Fast-follow: Download assets after installation.
- On-demand: The game initiates asset download as needed.
PAD requires that games are packaged using the App Bundle format. PAD can also reduce the amount of data used by a developer's CDN (if one is still needed).
Google Play uses Android App Bundles to generate and serve optimized APKs for each user’s device configuration. These optimized APKs include a single set of texture assets, formatted with the optimal compression format for the device. Configure your app bundle to support different texture compression formats to support the widest array of devices.
Determine the baseline size of the game and understand its structure
To familiarize yourself with the game, determine the amount of work required for any given optimization, and determine whether the game downloads additional assets, perform the following steps:
- Use a production (non-debug) build from the developer or the published APK.
- Record the size of the binary file either as delivered by the developer or, if the game has been published, on the game's Play Store page. For APK size, the most important factor is the amount of data a user must download to run the actual game.
- Install the game on a device and run it to the initial game menu. At this point, check the install size of the game as reported by Android (under Settings > Storage). Some games have a small initial install size, as this is the key number to optimize, but download additional data after install. Some games download multiple gigabytes of data after install.
- Some games download data only after you start playing them. You should play the game for a bit to determine how much additional data the game downloads for a typical user playing the game for the first time.
Search for assets and other files that can be reduced in size
This section describes how to reduce the size of files in an APK. You can use the App Bundle Explorer to download device-specific APKs.
To reduce the size of files packaged directly into the APK, perform the following steps:
- Use the Android Studio APK Analyzer. In Android Studio, select File > Profile or debug APK and select your APK.
- Select the Assets folder. For each file, the raw file size and the percentage of the total download size are listed.
Review the Assets folder and determine where the bulk of the game's data is located. Determine whether there are any assets that take up an excessive amount of space (that is, greater than 1% of the total). In particular, look for the following:
- Large image and video files (for example, PNG, JPEG, and mp4 files): These files are typically used in splash screens, backgrounds, and logos. These files are rarely used in most games and can be compressed further without affecting the user experience. Lossless PNG files are particularly large and are excellent candidates for compression.
- Large font files (for example, TTF files): If you add emoji support, it can significantly increase the font file's size. If a font file is larger than a few hundred kilobytes, consider ways to reduce its size.
- Duplicate audio file formats or versions that you can combine.
If multiple Application Binary Interfaces (ABIs) are included in the APK, move to App Bundles or build multiple APKs.
Determine the size of the binary shared object (.so) files. To inspect binary files to see whether there are things that might not need to be included, such as log files, you can use the Bloaty McBloatface tool. For more information about how to optimize the binary files, refer to compile flags and options.
Review the Android manifest file for supported graphics formats. Determine whether there are multiple
<supports-gl-texture>
tags in the APK. If the game supports formats for multiple GPUs in one APK, then consider using Binomial's Basis Universal. This GPU texture compression system creates texture files in an intermediate format that can be quickly transcoded to the GPU.
Inspect the graphics textures and identify opportunities for optimization
This section describes the tools and methods required to determine whether the graphics textures used in the game can be optimized.
To inspect the textures in the game, use Android GPU Inspector (AGI), RenderDoc, or, for Qualcomm Snapdragon GPUs only, Snapdragon Profiler.
Look for the following:
- Textures that can be resized to a smaller resolution, such as a large texture for something that is only rendered at a small size in the game. Downsampling textures is computationally expensive.
- Use of multiple small textures that can be combined into a single texture map.
- Textures that can use fewer bits in the color channels. Good candidates are textures with a few, solid textures. Gradients and shades of color require more bits of resolution, and therefore aren't good candidates.
- Explore better texture compression algorithms, from ETC1 to ETC2 and ASTC.
Discard the top mipmap level when loading the textures on lower end devices to save memory. Unity's Texture Streaming system can do this.
If you haven't already done so, review the Android manifest file for supported graphics formats. Determine whether there are multiple
<supports-gl-texture>
tags in the APK. If the game supports formats for multiple GPUs in one APK, then consider using Binomial's Basis Universal. This GPU texture compression system creates texture files in an intermediate format that can be quickly transcoded to the GPU.
General recommendations for assets
Follow these recommendations for an APK's assets:
- Image, audio, and video assets (not GPU textures): Determine whether the assets can be resized or compressed even further. Higher compression ratios are usually acceptable for games. Lossless PNG files are particularly large and are therefore excellent candidates for compression.
- Image assets (not GPU textures): Consider using WEBP, an image compression format for both lossy and lossless compression. Lossy WEBP compresses images 25% to 34% more than JPG.
- Reduce texture resolution: A texture much larger than the number of pixels that ultimately render on the screen is an inefficient use of space and GPU resources. To change a texture and see what it looks like in a frame without the need to rebuild the game, use AGI.
- Change graphics' texture formats: Use texture formats that use fewer bits per channel. For example, use a 16-bit texture format such as RGB565 instead of a 32-bit texture format such as ARGB. For more information, refer to the following:
Additional resources
- Recent Android App Bundle improvements and timeline for new apps on Google Play
- Reduce APK size in Android instant games
- GPU-decodable Supercompressed Textures (research paper)