Version: Unity 6.7 Beta (6000.7)
Language : English
Export an Android project
Deliver Android applications on Google Play

Optimize distribution size

Some digital distribution services have a limit on the initial install size of your application. Unity includes the following methods to help you to optimize the install size:

Split APKs by target architecture

If your output application uses APK format, the Split APKs by target architecture Player setting optimizes the application download and installation size.

To split APKs by target architecture, follow these steps:

  1. Open the Project Settings window (menu: Edit > Project Settings).
  2. Select the Player tab, then open Android Player settings.
  3. In the Other Settings > Android Application Configuration section, enable Split APKs by target architecture.

After you enable this setting, Unity creates a separate APK for each CPU architecture instead of producing one APK that contains binaries for every target CPU architecture selected in the Target Architectures Player Setting. You can upload this set of APKs to digital distribution services which serve the APK with the correct target CPU architecture to each device that downloads your application.

Google Play primarily supports this feature, which might not work for other digital distribution services. For more information, refer to Multiple APK support.

Note: Google Play requires new applications to be AABs and not APKs. When you upload an AAB, Google Play automatically generates and serves optimized APKs for each device configuration.

Split the application binary

You can split your output application to make the initial install size smaller. The device can install a lighter version of your application and then download assets separately.

To split the application binary, follow these steps:

  1. Select Edit > Project Settings.
  2. In the Project settings window, select the Player tab, then open Android Player Settings.
  3. In the Publishing Settings section, enable Split Application Binary.

When enabled, Unity splits your application depending on its output format. For APK format, Unity creates a main APK and an expansion file (OBB). For more information, refer to APK expansion files. For AAB format, Unity creates a base module and asset packs. For more information, refer to Play Asset Delivery.

Compression

You can change the method Unity uses to compress resource files for the application.

To change the compression method, follow these steps:

  1. Open the Build Profiles window (menu: File > Build Profiles).
  2. Select or add an Android build profile.
  3. In the Platform settings section, locate the Compression Method setting.
  4. Choose your preferred compression method.

Compression can reduce the size of the application but can increase loading times if decompressing the data takes longer.

Minification

You can use ProGuard minification to decrease the size of the application and improve performance.

To enable ProGuard minification, follow these steps:

  1. Select Edit > Project Settings.
  2. In the Project settings window, select the Player tab, then open Android Player Settings.
  3. In the Publishing Settings section, locate Minify.
  4. Enable the Release checkbox, the Debug checkbox, or both, depending on the type of build you want to minify.

Note: ProGuard might remove code that your application depends on. Test any builds you minify to verify that ProGuard didn’t remove critical functionality.

For more control over the minification process, generate a custom proguard.txt file and configure it to specify what not to strip. To generate the file, select Custom Proguard File in the Publishing Settings section. This generates the proguard.txt file in your project’s Assets/Plugins/Android folder. For information on how to configure ProGuard minification, refer to the ProGuard documentation.

Additional resources

Export an Android project
Deliver Android applications on Google Play