Obfuscation question

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

Hey. Who can tell you about obfuscation? I am making an android application. I did as stated in this article
https://docs.godotengine.org/ru/stable/development/compiling/compiling_with_script_encryption_key.html

But when you start the application, the screen flashes a couple of times and then the application closes. While the compilation is fine. And without obfuscation, everything works well too.

You should install the Android build template only after copying the custom compiled debug and release apks in the templates folder of godot.

wbgyor | 2020-09-21 09:44

Sorry, I don’t understand what you mean. I reinstalled the android build templates but the situation hasn’t changed. Could you please describe in more detail the order of actions that I should do?

Bakz | 2020-10-01 08:58

:bust_in_silhouette: Reply From: wbgyor

1.Firstly get the source code of godot which matches the version of binary you are using. ( if you are using version 3.2.2.stable then get its source code from github).
2. Go to root of the source and generate key and set environment variable mentioned in this doc.
3.Generate your custom templates by following these steps.
4. Then you can go to Project Settings > Install Android Build Templates.
5. Now you can export your apk , make sure all the steps have been done correctly and the key used while compiling the custom templates are provided in the export settings .

Hope this works for encrypting your apk.

I am getting this error.

I am getting this error.

Bakz | 2020-10-01 12:30

Looks like scons can’t find the android platform, as it’s only listing server and x11. Did you set up the following variables in the environment? ANDROID_HOME and ANDROID_NDK_ROOT

Bernard Cloutier | 2020-10-01 12:59

enter image description here

I may not have installed the NDK correctly

Bakz | 2020-10-01 13:25

Check whether you have configured Android Studio and Ndk correctly. Make sure you have installed the Ndk correctly by opening Android Studio and go to Tools > Sdk Manager > Sdk Tools. Check this doc

wbgyor | 2020-10-01 15:35

It turned out that these variables are saved only in the current terminal session, in another terminal window these variables are not. Therefore, I did everything in one terminal and the export templates were compiled.

But the problem with obfuscation remained. The obfuscated application blinks with the screen after launching and closes.

Bakz | 2020-10-02 07:43

Consider doing these steps again without using encryption key and find out whether all other steps have been done correctly… !!!

wbgyor | 2020-10-02 08:05

I did it all over again without a key and with a key. The screen still flashes and the application closes. It looks like the key is not being applied to export templates. But I did everything strictly according to the instructions.

I also tried to set custom templates in the export settings, the same situation.

Bakz | 2020-10-02 11:20