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:
If your output application uses APKThe Android Package format output by Unity. An APK is automatically deployed to your device when you select File > Build & Run. More info
See in Glossary format, the Split APKs by target architecture Player Setting optimizes the application download and installation size. Instead of producing one APK that contains binaries for every target CPU architecture selected in the Target Architectures Player Setting, Unity creates a separate APK for each CPU architecture. 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.
This is primarily a Google Play feature and may 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.
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. If your output application uses APK format, Unity can split the application into a main APK and an expansion file (OBB). For more information see APK expansion files. If your output application uses AAB format, Unity can split the application into a base module and asset packs. For more information, see Play Asset Delivery.
To split the application binary:
You can change the method Unity uses to compress resource files for the application. This can reduce the size of the application but can increase loading times if the method means data takes longer to decompress.
For more information, refer to Compression Method.
You can use ProGuard minification to decrease the size of the application and improve performance.
To enable ProGuard minification:
Note: ProGuard might strip out important code that your application relies on, so check any builds that you minify.
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 ProGuard documentation.