Unity 4.6+ How to reduce .apk size

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?

2 Answers

2

Ok …Just go to Project Setting–>Player

Make sure you have selected Device Filter to ARM 7 only

Because in unity 4.6 the build supports both x86 and ARM 7 by default . So its a bit fat.

Select ARM 7 and you are good to go

For More check this out UnityRealm.com is for sale | HugeDomains

Hope this helps you

Thank You very much, this solved my problem

I 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 : 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

I 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.

Thank you, it seems to work pretty well. I am using Unity 5. What is the downside of deselecting x86 @Noob_Vulcan

you can get some points regarding to optimization from this video :