Huge size of android build (SOLVED)

Hello,

Testing Defold for the first time. I created an empty mobile project with only the default app icons for ios and android, a simple game object containing a text box for fps measure and other for simple increment counter. The debug apk size is ~8mb and upon installation reaches to ~40mb on device. What am i missing ?

The debug package doesnā€™t strip the executable, and the shared library is then quite big.
If you test the Release variant, you should see much better results.

2 Likes

I notized something similiar. I updated the Engine today to v.1.2.140. And i got a increased APK file size to +1,1mb !!! I mean, with my old Defold version my APK file size was lean ā€¦ about 2,82mb !

v1.2.134 = 2,82mb
v1.2.140 = 3,96mb

It was allways build by ā€œreleaseā€ mode (just a empty-scene for testing). So i donĀ“t know what to do. Can someone explain why this increased ? Now i am afraid, that with every update of DEFOLD the APK file sizes could getting bigger & bigger ā€¦ :disappointed_relieved:

We updated the Facebook SDK recently and also the Google Play Services SDK (for updated push.* support). We are investigating how to use ProGuard to strip the Jar files (of internal and native extensions). I do not have en ETA for this though.

In general the size of the engine is kept more or less constant over time as can be seen in this graph: https://github.com/britzl/dmengine_size

1 Like

here is answer: Build size. Auto Stripping or manual configuration

3 Likes

So you have ~4mb on ā€˜releaseā€™ mode with version 1.2.140 ? Can you tell me the debug size of armv7 android with empty mobile project? Thanks.

Donā€™t be. Executable size is something we care very much about.
As mentioned in the other thread, we plan on using Proguard to strip away unnecessary Java stuff.
We have done some initial tests, but we donā€™t have an ETA when that support will be in.

That said, as we add actual features to the core engine, the size will ofc grow. This is also why we want to use native extensions as much as possible. Both in terms of moving them out of the core engine, as well as implementing new features as native extensions.

9 Likes

Ah ok. Good to know. Thx. Somehow the info about updated modules in the Android Build didnĀ“t reached me. So there is a way to strip it down to your needs?! I think i read somewhere about it, doing it by setting it up inside the code which modules should be included and which not ā€¦ right ?

As shown in the graph, it looks constant, with a high peak at the current vers. I also can see that you can descide which library (arm-7 android, darwin, x64) you want to use when doing a build !? Is that correct ? I think it would be a ā€œnice-to-have-featureā€, to put some checkboxes inside the ->project->Bundle window to make your settings about it.

It means, if it is possible to turn off the modules of fB-SDK and the Google-Play-Services, i can reach much more ā€œlight-weightā€ APKs ā€¦ right ? What is this ā€œProGuardā€ (an AddOn for DEFOLD) ? Is there any info, any link about it ?

@shivamā€¦iĀ“ve done a debug-build and the exported debug-APK-vers. takes about ā€œ8.68mbā€.

You can read about Proguard here

Yes, itā€™s possible to remove certain libraries that you donā€™t need by using an app manifest.
You can create one here. Note that this doesnā€™t currently make your classes.dex file any smaller.
In the long run, thereā€™s going to be a better way of configuring these things directly in the editor, but we donā€™t have an eta for that.

Iirc, we require the google-play-services for something, but yes, it should also be possible to skip in the future.

3 Likes

Changing the mode to release version makes the apk go down to ~4mb with default settings on empty project and after installation it goes to ~13mb which is much better.
Solved the problem.

3 Likes