Reducing build size,an attempt to get the smallest size empty project packaged

I’ve been looking into how small we can really get a project packaged to, more precisely how small an empty project could be.

In Unity for example an empty project is only around 10Mb as an Android APK so i wanted to see how close we could get to this, as i know it’s a big concern for a lot of devs working on mobile who want to keep the final size as small as possible.

This thread is going to be showing my progress as I try to get the size as low as possible while keeping things functional.

Hope this helps devs getting smaller size builds, and hopefully Epic getting us some easier ways to achieve this.

Note:
This is all using UE4 4.21.1, and the android SDK from the tools folder.

1 Like

STEP 1

  • Made a new Empty project with No Starter Content, Scalable 3D/2D quality, Mobile/Tablet Target
  • Used the official documentation to tweak the Project Settings for the obvious basic optimizations
  • Deleted the default map and made an Empty map instead as the only map and only asset in my content folder.
  • Cooked all of this for Android ETC1

Here’s the result:
emptyProj_step1.JPG

About 42Mb for an empty project with recommended settings… not amazing.
Hopefully there’s a lot more things we can do in the next steps

STEP 2
Turn off most plugins

I went into the plugin browser and turned off every plugin i could see enabled that i knew i wouldn’t need or at least didn’t sound like it would explode if i did.
Not much left on by the end (only android/AI/Physics related crucial things) NOTE: I didn’t test anything in editor/built game so I don’t know how usable it still is.

Here’s the result:
emptyProj_step2_all.JPG

Step 1: 42,309 Kb
Step 2: 37,586 Kb
Saved: 4,723 Kb

So we saved a bit, but I was really hoping for more… next steps are going to be tough because I don’t really know what else to trim…

For picky people here’s the list of what i turned off:


Virtual reality:
- Oculus VR
- SteamVr

Unreal Studio:
- Datasmith content
- varient manager content

Source Control:
- Git
- Perforce
- Subversion

Rendering:
- Cable Component
- Custom Mesh Component
- Editable Mesh (+Mesh Editor dependency)
- Light Propagation Volume
- Media Compositing
- Procedural Mesh Component (+ ML/Steam/Oculus dependency)

Programming
- CLion
- code lite
- KDevelop
- Linux Compiler
- VS Code integration
- VS integration
- XCode integration

Physics (Kept runtime PhysX Cooking)
- PhysX Vehicles

Other
- Crypto Keys

Online
- Online Subsystem iOS

MoviePlayers
- Windows movie player
- movie player for WebM
- magic leap screens
- apple movie player

Misc
- Experimental HMTL5 networking
- mac graphics switching

Media PLayers
- AVF
- Image sequence (+Medai Compositing dependency)
- Linear timecode
- WMF
- WebM (WebM movie player dependecy)

Importers
- Alembic
- Geo cache

Gameplay
- Archvis character

Experimental
- Apple img utils
- Applevision
- backchannel

Examples
- uobject

Editor
- actor sequence
- facial animation importer
- speedtree importer

AR
- all off

Audio
- All off

STEP 3
PAK blacklisting

This is where I think Epic needs to do some work, we shouldn’t have to use a blacklist file like that to prevent editor files from making it into cooked shipping content…

Thanks to Cory Spooner over at MorePork games, who has some good info on reducing package files
Check out his post about it, good tips there

I’m using the exact same PAK blacklist file he’s using, here’s the result:

emptyProj_step3_pakblacklist_01.JPG

The APK file size did not change at all, but the OBB (where most assets are), has lost 1 246 Kb…

That doesn’t sound like much, but if you look at the folders the blacklist is pointing at, it’s mostly editor content (slate icons, EditorVR, editor tutorials…) that should never be in a packaged build in the first place.
And his blacklist doesn’t even exclude half the folders… i’ll have to do a test with most folders next

Note for Epic: This is pretty bad guys, we shouldn’t have to do this manually.

Reminder again though, I haven’t tested anything after this so…

Interesting that the pakblacklist didn’t save much for you. It saved a crapload on iOS. Perhaps the Android programmer(s) exclude a lot of fat automatically (compared to iOS).

did you inspect the .apk And see what takes up the size? I wonder how much of it is the main binary(s).

in the APK libUE4.so was 27 379 Kb out of the 29 111 Kb total size.
i’m planning to make all my projects and APK available for people to check out soon.

STEP 2-3
Android specific stripping

Thanks to Peter Newtown here’s an extra way to save on build size, specifically on Android

Using his tutorial on Proguard he was able to get an empty project down to a 19 Mb APK, which is much better.

It is a pretty advanced/manual process and android specific though
Check it out here

hi can u help me peter newtons example ı dont made it ı send u a post please help me