Optimizing a build for size

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GuilhermeA

Hello, I’m a beginner in godot, but I’m already getting used to this concept of us, my question now is about the size optimization of the apk generated for Android. I read about it in the documentation at Optimizing a build for size

But I’m having a hard time performing this procedure, could someone help me or instruct me, please.

Where is the documentation unclear to you? The page to which you linked is meant for compiling custom export templates for the engine.

Ertain | 2020-09-05 17:21

In the scons settings, should this be installed with the separate script?

GuilhermeA | 2020-09-07 11:35

What should be insisted? Or are you asking about the different parameters that can be passed to scons so as to build an export template?

Ertain | 2020-09-07 16:33

I don’t know how to configure scons to make the export more optimized, that’s my question!

I need help to do it

GuilhermeA | 2020-09-08 16:00

:bust_in_silhouette: Reply From: Ertain

Ah, gotcha.

When you have installed scons (as well as the other necessary build tools), you probably won’t have to set up anything else; the defaults will probably do fine. When you build the engine, all you’ll probably have to do is pass the necessary key-value pairs to scons. To see the full list of stuff that you can remove from the engine, use the command scons --help from the command line/command prompt. One of the nice things about the engine is that it can be optimized for you.

In the section on optimization, you can build the engine with the option optimize=size. For example, when you’re on your Windows box, change to the folder (via the command prompt) which contains the Godot source code, and issue a command like this one:

 scons p=windows tools=no target=release optimize=size

To be fair, I have never used this option. But at least it will point you in the right direction.