How to optimization android package's size

I tried to packaged a android Apk for blank project.

it seem like 60mb for a package

it is a very big size for blank project.

how can I optimization android package’s size.

Anybody know ue4 will optimization android package’s size

Follow these steps, you can reduce the final package size for about 15M to 20M:

a. Project settings

-Make sure using Shipping instead of Development for Build Config

-Target hardware should be Mobile/tablet

-Build ETC2 instead of ETC1 (ETC2 may be incompatible for some devices, so its optional)

b. Go to your engine folder

-move [Engine Root]\Content\Slate\Common and [Engine Root]\Content\Slate\Common to a backup folder (you want to move them back after packaging).

-Open [Engine Root]\Config\BaseEditor.ini with a text editor
Change +ContentDirectories=/Engine/MobileRsources to be -ContentDirectories=/Engine/MobileRsources

c. Package your project

That is all I currently do. It doesn’t satisfy me very well but can make things a little bit better. Hope the Unreal team can provide a better solution.

Thank you very much,it is a way to do that .but I still hope unreal engine team have a good solution to reduce the packaging. but until now not a stuff to answer this kinds of question.

I just packaged an Android ATC project with 38 MB of game content into a 14 MB OBB which yields a total all-inclusive APK size of 34 MB. That’s the smallest I can get so far for a full HDR 3D game. Here’s my changes:

  1. I applied the attached patch to the 4.7.6 engine source. This patch excludes Slate and drops PhysX etc.

  2. cleanup source: Engine/Build/BatchFiles/Mac/SetupMono.sh Engine/Build/BatchFiles/Mac
    mono Engine/Binaries/DotNET/UnrealBuildTool.exe UE4Game Android Shipping -clean /project_path/music_flying_game_v2.uproject

  3. env vars:
    export ANDROID_HOME=/gitosis/SDKs/android-sdk-macosx/
    export ANT_HOME=/gitosis/SDKs/apache-ant-1.9.4/
    export NDKROOT=/gitosis/SDKs/android-ndk-r10c/

  4. download thirdparty:
    sh Setup.sh

  5. compile:
    source Engine/Build/BatchFiles/Mac/SetupMono.sh Engine/Build/BatchFiles/Mac
    mono Engine/Binaries/DotNET/UnrealBuildTool.exe UE4Game Android Shipping -deploy /project_path/music_flying_game_v2.uproject

  6. recompile automation tool (for custom cooking):
    source Engine/Build/BatchFiles/Mac/SetupMono.sh Engine/Build/BatchFiles/Mac
    xbuild /property:Configuration=Development /property:Platform=AnyCPU /nologo Engine/Source/Programs/AutomationTool/AutomationTool_Mono.csproj

  7. cook Android ATC:
    cp /project_path/Binaries/Android/UE4Game-Android-Shipping-armv7-es2.apk /gitosis/UnrealEngine/Engine/Binaries/Android/UE4Game-Android-Shipping-armv7-es2.apk
    ./Engine/Build/BatchFiles/RunUAT.sh BuildCookRun -nocompileeditor -nocodeproject -nop4 -project=/project_path/music_flying_game_v2.uproject -cook -AdditionalCookerOptions=“-compressed” -stage -archive -archivedirectory=/project_path/out -package -pak -compressed -compress=best -strip -clientconfig=Shipping -ue4exe=UE4Editor-Mac-Debug -clean -nodebuginfo -targetplatform=Android -cookflavor=ATC -utf8output

Here’s a table of the resulting Engine data in my PAK:
$ du -h -s Engine/Content/*

240K Engine/Content/BasicShapes

4,0K Engine/Content/EditorBlueprintResources

4,0K Engine/Content/EditorLandscapeResources

136K Engine/Content/EditorMaterials

432K Engine/Content/EditorResources

4,0K Engine/Content/EngineDamageTypes

12K Engine/Content/EngineDebugMaterials

600K Engine/Content/EngineFonts

5,2M Engine/Content/EngineMaterials

68K Engine/Content/EngineMeshes

96K Engine/Content/EngineResources

28K Engine/Content/EngineSounds

4,0K Engine/Content/EngineTireTypes

36K Engine/Content/Functions

3,4M Engine/Content/Internationalization

400K Engine/Content/Localization

160K Engine/Content/Maps

1,2M Engine/Content/MobileResources

12K Engine/Content/Stats

As you can see, most engine bloat (and especially the 15 MB of slate fonts) are gone :slight_smile: And you might have noticed my special cooking options:
-AdditionalCookerOptions=“-compressed” -pak -compressed -compress=best
which make sure that the 50MB engine and game data get down to a 13.8 MB OBB.

Hope this helps others getting started with size optimizations :slight_smile: All the best,