Script encryption crashes android game

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

Hello everyone,

I am trying to use script encryption feature available in android export. I have followed each and every step as in following pages, but my game crashes when starting. adb logcat shows multiple errors as follows:


ERROR: The MD5 sum of the decrypted file does not match the expected value. It could be that the file is corrupt, or that the provided decryption key is invalid.

Previously I used Godot 3.3 on Windows 10. But as the source downloaded was for 3.3.2, I downloaded Godot 3.3.2 & tried the same process again but still no luck.

After downloading source for 3.3.2.stable, I followed this procedure:

  1. In I selected aes-256-cbc & generated key. I got salt, key & iv

  2. Opened command prompt & used the above key in set SCRIPT_AES256_ENCRYPTION_KEY=your_generated_key command

  3. Then executed following commands in shown order:
    scons platform=android target=release android_arch=armv7
    scons platform=android target=release android_arch=arm64v8
    cd platform/android/java
    .\gradlew generateGodotTemplates
    scons platform=android target=release_debug android_arch=armv7
    scons platform=android target=release_debug android_arch=arm64v8
    cd platform/android/java
    .\gradlew generateGodotTemplates

  4. I got some new files in bin folder without any errors

  5. Out of those files I copied android_release.apk & android_debug.apk to C:\Users\Digital\AppData\Roaming\Godot\templates\3.3.2.stable. (Files with same names were already present in that folder, so I renamed the older files)

  6. In export settings set the above files in respective custom templates

  7. In export settings, set script export mode to Encrypted & set the same key here

When tried to run the project on android device with script mode to encrypted, splash screen appear for some time then the game is crashed. If the mode is set to compiled then the game is run normally.

Please answer if anybody has succeeded in script encryption in Godot v3.3+ I am desperately waiting for an answer.

vbdev | 2021-07-03 13:07

I followed the exact same steps and it still doesn’t work for me either.

blurrred | 2021-12-23 04:20

:bust_in_silhouette: Reply From: blurrred

I think I have finally found a solution here: Android Export : 'Use Custom Build' option DOES NOT USE 'Custom Template' setttings, for android_debug.apk and android_release.apk · Issue #43817 · godotengine/godot · GitHub

I am not sure if this will break compatibility with any plugins, but so far all of the ones I am using work.