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