I noticed that the Flappy Bird .apk
is only around 900 KB. I'd like to know how I can achieve a similar optimization in .apk
file size for my own games, which use Unity. A small single-scene game developed with Unity will have an .apk
size of nearly 10 MB, in comparison.
-
1\$\begingroup\$ Why do you think Flappy Bird was made with Unity? When you develop Android games in Java and base them solely on the native API, they can be even smaller. \$\endgroup\$– PhilippCommented Nov 13, 2014 at 16:03
-
1\$\begingroup\$ If you look at the features in Unity's site they mention as an extra pro feature: "Build Size Stripping Keep your applications size small for mobile devices. We'll strip out parts of the engine that you aren't using." So I assume (but I am not sure) that small file size is only possible for pro version users. \$\endgroup\$– user40079Commented Nov 13, 2014 at 21:05
2 Answers
It's possible to use an Android "APK Expansion File" so that additional content is downloaded at runtime the first time you launch it.
Next, if you have very few graphics that always repeat (if I remember well Flappy Bird has very few graphics assets) they can be compressed in the .apk
and expanded in-memory during execution. Graphics and art assets are the files that have more impact on final .apk
sizes than most other assets.
Unity loads a lot of stuff, but if you program the game directly in OpenGL you are able to cut your code and libraries to the essential and achieve very small packages.
I remember the time when adventure games (like Maniac Mansion) were all in one floppy disk.
Unity is a very powerful and very complex game engine. Most games only use a small fraction of its features. But no matter how much of it is actually used, a game which uses the Unity engine must include the whole engine which is a hefty 10MB chunk of additional filesize.
For a very simplistic game like Flappy Bird, using such a huge engine is usually overkill. They can usually be made using just the native Android API which allows to create much more compact applications.