Android .apk file size confusion

Hi Guys,

Slightly confused on the file size of my .apk. Can someone say if this is right?

Game Contains

  • 1 Scene
  • 0 Textures
  • 3 Canvas’s (With only panels using default texture and texts)
  • 3 Camera’s (Each with a canvas attached)
  • 4 Scripts - Each one under 100 lines and doing nothing more than canvas navigation. They’re not using anything more than: “using UnityEngine;”, “using System.Collections;”
  • NOTHING ELSE

Safety Checks Done

  • API Compatability Level: .Net 2.0 Subset
  • Device Filter: ARM7 + x86 <— I know this means it gets built twice, but it’ll need that when it goes live anyways.
  • Stripping Level: Use micro mscorlib

Also for reference here is the Editor Log:

Textures 16.2 kb 0.4%
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 1.0 kb 0.0%
Levels 52.6 kb 1.2%
Scripts 414.8 kb 9.2%
Included DLLs 3.9 mb 89.0%
File headers 15.7 kb 0.3%
Complete size 4.4 mb 100.0%

Used Assets and files from the Resources folder, sorted by uncompressed size:
17.0 kb 0.4% Resources/unity_builtin_extra
4.0 kb 0.1% C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll
1.6 kb 0.0% C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll
0.1 kb 0.0% C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Advertisements/UnityEngine.Advertisements.dll
0.1 kb 0.0% C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll
0.1 kb 0.0% Assets/Scripts/ViewController.cs
0.1 kb 0.0% Assets/Scripts/UtilityHelper.cs
0.1 kb 0.0% Assets/Scripts/MainController.cs
0.1 kb 0.0% Assets/Scripts/TestClass.cs
0.1 kb 0.0% Assets/Scripts/Singleton.cs

There is NOTHING else in the game. No lighting, no 3D models, no animations, no physics (that I know of).

However the .apk size is 20mb, and the installed size is well over 40mb. The editor log however says that the apk is only 4.4mb, which sounds a lot more accurate for what I’ve built.

Is there something being included like dynamic lighting, or physics, or something like that which I’m able to strip away to make this a more minimal app? I understand that there’s some things that Unity will include, but this doesn’t even have any textures or models. It’s only panels and text and hits 47mb.

Any ideas?

Thanks!

By turning off ‘Development Build’, the apk size itself reduces to 17mb, however the application size in my Android’s Task Manager is 45.74mb, which sounds off the charts for what I’ve built (?).

The editor log that unity prints out only shows the actual game assets that make it into the built player (textures, models, sounds, DLLs, etc).

It does not take into consideration any other overhead such as the mono libraries and runtime and Unity’s libraries (included twice, once for each architecture - x86 and ARM).

You can unzip your .APK (convert it to a .zip extension and unzip it) and have a peek inside to see what’s taking those 20 mb (it’s from the libunity.so and libmono.so x 2).

You can get away by releasing 2 APKs to the market - one for ARM and one for x86. This adds some overhead for managing that, but it’s still possible if your APK is too big (there are other techniques such as OBB files that you can explore).

Lastly, i have no idea why Android i listing 45.74mb as the size of the installed app - maybe it counts some logs that are being written, or files that are expanded upon install (the new ART runtime will basically AOT compile the installed package as far as i know, maybe that bloats the install size).

1 Like

So the shortest answer in the world is, “Yes, that is the expected .apk size”. You can tweak it and try to find a way to run it down a little, but that’s just the cost of the overheads for a Unity application.

It might be good practice to unzip it and look through the contents for a finer look, but really I’m happy enough. So long as I know there is not some glaringly obvious ‘thing’, that you need to remove or turn off to make it go down by a large amount, and this just IS the size of Unity apps, I’m happy.

Thanks for the help!

1 Like