The ultimate quest for pak size optimization!

The size of the Android build is… unacceptable. There are some optimizations for reducing APK size and this is awesome, but the obb file is still huge.
I know that there are options for shrinking it’s size but come one… why do I have to dig around, selecting magic checkboxes when it should be out of the box!

So, with this introductions - here are some improvements and suggestions:

1. Don’t include Engine/Content/Tutorial directory when SkipEditorContent enabled
Yeah, so there is a nice checkbox that excludes from cooking any editor related content, which is nice, but it still adds the Editor Tutorial content. We don’t need it.
Also, maybe it is a good idea to have the SkipEditorContent enabled by default?
Pull request:
REJECTED. There is a bug related to it UE-26327. They are on to it.

2. Improve the PakBlackList functionality
There is an option for ignoring cooked files to be packed into the pak file, but it would be nice to improve it:

  1. Make it hierarchical, like config files - Base in the Engine Build directories, then for Game Build directories for all build configurations, and then for Game Build directories for specific build configuration.
  2. It would be nice to have some base blacklist for files we know they shouldn’t be inside.
    Pull request:

3. Engine directories to never cook list
Just like the game directories to never cook but for the Engine. There are lot of files I do not use but they are put into the final build anyway.
There should be a list that ignores specific files or directories when cooking.
Pull request:
REJECTED. Epic stuff is concerned that this commit might break the stability.

With this I could go from 122MB to 82MB. 26MB with compression enabled for Third Person Template project. So we’re getting somewhere, but this is still hell of a content, which I’m not sure if it is necessary there.

The main issue is that there is a content that is not openly referenced inside the project but it is cooked and packaged anyway. The best solution would be to find these references and get rid of them, but we’ve got 16th iteration of the Engine and the issue is still there from the very beginning. Because of this, it would be nice to have some power in deciding what goes to the build and what not.
And I know that these mechanism are present for a long time, but they are not visible enaugh. In my opinion - most of them should be enabled by default!

I suggest to make a list of content that is no desired for a packaged game:

Do You have any idea how to improve shrinking content size of pak? Some more mechanisms, tools, or blacklisted files?

Thanks for suggestions and good luck with Pull Requests! :smiley:

<3 thanks for doing this!


“Blacklist DefaultBloomKernel on mobile platforms (unneeded and takes 32MB)”

Nice! Maybe whole editor stuff shouldn’t go to mobiles by default too? What do you think?

well ideally i’d like it to be fully optimized, i get a ton of complaints about this, I’ve never inspected the apk & I don’t know what we can live with out

I’m just glad Epic is finally making a mobile game so they are dog-fooding UE4 Android and all this stuff will be resolved finally

Still dont have experience to look deeper at how UE4 compiling for mobile, but feels that it compiles some extra non-necassary stuff
so, thumb up for such thread!

Digging out an old topic of mine, but after some time (and after some awesome new features in 4.21) here’s a recap of what I know what to do to optimize build size for Android:…real-engine-4/

I hope it will help :slight_smile: