How to optimize the apk package size?

Hey there,

i am doing a little UI-only Game for Android.

Export and run on android works fine. What i like to do is, i want to avoid any unneeded files inside the apk package.

The only thing that should be visible is the ui, no world behind it or something.

Unfortunately my apk is already 65mb in size and thats for a state considered as just started.

Any hints would be helpful :wink:

regards

I think you’ll find this link helpful, especially towards the bottom of the article: https://docs.unrealengine.com/latest/INT/Engine/Basics/Projects/Packaging/index.html

There’s some info about this on this AnswerHub page: Why are android file sizes so big? - Mobile - Unreal Engine Forums

Basically Unreal includes a bunch of content (Slate UI content, in particular) in your game by default and you need to remove that content manually before packaging. Hopefully a future engine version will make this an option during packing if it isn’t already.

Thanks for your replies. Im gonna check them out :slight_smile:

I am making some simple space shooter. I had nice earth all with clouds, normal map, ocean shine, night lights etc. I optimized textures as much as i could.
Result was 270mb of packaged game. So yesterday i cut out everything i could (replaced earth with just rock texture). And everything got down to about 80mb size.

IMO the worst enemy of any mobile game are textures, next in line are transparent materials and particles.

Textures are tricky beast, you want them high resolution so your game does not look like ****. But that inflates package size fast. So whatever possible use geometry instead of textures, use separate material IDs instead of texture with uv layout.

In my case instead of using 3 2048 textures for earth, I will use two 1024 tillable rock textures for some cracked moon model. Then either i use vertex paint for blending normal and lava versions for rock material, if that (vertex painting) does not work on mobile i try greyscale mask for blending, or some coordinates/world position trick in material shader. Or just plain material IDs.

For space skybox i tried to use cubemap texture, but this alone was 120mb. So i split it into 6 textures, mapped on cube (which i did turbosmooth later to sphere). I scaled down those skybox textures to 128x128 (yes that low) and used them as color mask for coloring tillable star mask. Now my skybox looks far better and it uses only few mb instead of 120.

Another example, i wanted gas giant texture, but those planets are huge, and from close texture pixels were well visible. So i made random stripes material out of few sinus nodes and horizontally stretched uvs (with fine vertical variation to break straight lines). My gas giant looks much better and uses no textures at all.

So make one folder for all textures, and when in doubt look there for big textures or textures with alpha (do not use those). If possible make materials that use no texture.

However there is another danger to this all: shaders get more and more complicated, i gain in size and lose in speed. One needs to keep balance, like in everything.