Hello,
I have just downloaded Android SDK, and tried to build a simple app, so I created new project, saved the default scene and made a build. The scene contains just the camera and nothing more, there are no assets or scripts in the project, just basic empty project without any packages imported. What I got was 14,1MB .apk file… I tried doing the same in older version of unity (4.2) and got 7,82MB .apk file.
So my questions is, how can I reduce .apk size in latest(as for now it’s 4.6.2f1) version of unity, apparently there were changes in engine since v4.2 but 14MB is way too much.
Output logs from different versions:
Unity 4.2
Textures 0.0 kb 0.0%
Meshes 0.0 kb 0.0%
Animations 0.0 kb 0.0%
Sounds 0.0 kb 0.0%
Shaders 0.0 kb 0.0%
Other Assets 0.0 kb 0.0%
Levels 8.9 kb 0.2%
Scripts 0.0 kb 0.0%
Included DLLs 3.7 mb 99.5%
File headers 8.1 kb 0.2%
Complete size 3.7 mb 100.0%
Unity 4.6.2f1
Textures 0.0 kb 0.0%
Meshes 0.0 kb 0.0%
Animations 0.0 kb 0.0%
Sounds 0.0 kb 0.0%
Shaders 0.0 kb 0.0%
Other Assets 0.0 kb 0.0%
Levels 9.6 kb 0.2%
Scripts 170.9 kb 4.1%
Included DLLs 3.9 mb 95.5%
File headers 8.2 kb 0.2%
Complete size 4.1 mb 100.0%
Used Assets, sorted by uncompressed size:
3.4 kb 0.1% D:/Program Files (x86)/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/4.6.2/UnityEngine.UI.dll
AndroidSDKTools:
root : D:/android-sdk
tools : D:/android-sdk ools
platform-tools: D:/android-sdk\platform-tools
build-tools : D:\android-sdk\build-tools\21.1.2
adb : D:/android-sdk\platform-tools\adb.exe
aapt : D:\android-sdk\build-tools\21.1.2\aapt.exe
zipalign : D:\android-sdk\build-tools\21.1.2\zipalign.exe
java : java.exe
Both output logs say that complete size is about 4MB.
I know that Unity Engine and Player files take some space but where additional 10MB come from?
Thank You very much, this solved my problem
– MaxszkutronI wish I can give you a 1000 thumbs up! Thanks for that tip, I just shaved 10mb off my APK from 24mb to 14mb :) I'm still hunting a few more things to figure out why the Editor.log file shows a completed size of 9.2mb and the file itself is 14mb, but this is a big step! If you have any more solutions or tips, let me know :)
– CB-InDev@CB-InDev : Good to hear that it helped you. There are many tips but they are project specific . One more thing if you are building for IOS then your can use ByteCode Stripping . Cheers
– Noob_VulcanI was wondering why my APK, that should be about 11 MB was 25 MB, but thanks to your answer Mr Vulcan, my problem was solved! Upvoted ofc.
– inakiktpThank you, it seems to work pretty well. I am using Unity 5. What is the downside of deselecting x86 @Noob_Vulcan
– Arpit_Rastogi