Reduce a size of APK and IPA – Unity 3dLast updated : May 23, 2017
Posted by: 6
For reducing APK size:
In Unity 5.6.0f3 I have created a simple "Hello world" program and build an APK file, it consumes 21.2 MB at first but to reduce the size you have to follow these steps:
1) Player settings > other settings > Optimization > API compatibility level > .NET 2.0 Subset.
To avoid memory wastage, Unity also supports the .NET 2.0 Subset API profile. This is very similar to the Mono "MonoTouch" profile, so many limitations of the "MonoTouch" profile also apply to Unity's .NET 2.0 Subset profile.Unity's .NET 2.0 Subset profile.
2) Player settings > other settings > device filter > ARMv7
ARM and x86 are both processor architectures. x86 belongs to Intel while the ARM is used by different companies and widely used, so no need to select both architectures.
3) Player settings > other settings > rendering path > Legacy Vertex
4) Player settings > other settings > Optimization > Stripping level > Use micro mscorlib
The Lightweight mscorlib version will be used at expense of limited compatibility.
Most games don't use all the functionality of the provided DLLs. With this option, you can strip out unused parts to reduce the size of the built player on Android devices.
After applying all these changes it becomes 10.4 MB.
For reducing IPA size:
In Xcode, there are few flags you need to set,
-Build Settings-> Enable Objective-C Exception-Yes
-Build Settings-> Enable BitCode-No
-Build Settings-> Compress PNG files -No