Optimize distribution size
Apply different optimization methods to reduce your application's installation and download size.
Read time 3 minutesLast updated 21 days ago
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:
- Open the window (menu: Edit > Project Settings).Project Settings
?
- Select the Player tab, then open Android Player settings.
- 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.
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:
- Select Edit > Project Settings.
- In the Project settings window, select the Player tab, then open Android Player Settings.
- 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:
- Open the Build Profiles window (menu: File > Build Profiles).
- Select or add an Android build profile.
- In the Platform settings section, locate the Compression Method setting.
- 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:
- Select Edit > Project Settings.
- In the Project settings window, select the Player tab, then open Android Player Settings.
- In the Publishing Settings section, locate Minify.
- Enable the Release checkbox, the Debug checkbox, or both, depending on the type of build you want to minify.
For more control over the minification process, generate a custom 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 file in your project's folder. For information on how to configure ProGuard minification, refer to the ProGuard documentation.
proguard.txtproguard.txtAssets/Plugins/Android