+1 vote

I followed the documentation: https://docs.godotengine.org/en/stable/development/compiling/compiling_with_script_encryption_key.html

Problem: I want to export for android with script encryption. I get same errors as on this page. ERROR: open_and_parse: Condition [...bla bla...] on Android.

Godot version: 3.2.4.beta1

Windows 10


Exact steps I did:

  • Created a key with openssl.
  • Set set SCRIPT_AES256_ENCRYPTION_KEY=your_generated_key
  • Executed following commands:

scons -j 6 platform=android target=release android_arch=armv7
scons -j 6 platform=android target=release android_arch=arm64v8
cd platform/android/java
.\gradlew generateGodotTemplates

Copied the bin/android_release.apk to %appdata%\Roaming\Godot\templates\3.2.4.beta1\

scons platform=android target=release_debug
android_arch=armv7 scons platform=android target=release_debug
android_arch=arm64v8 cd platform/android/java
.\gradlew generateGodotTemplates

Copied the bin/android_debug.apk to %appdata%\Roaming\Godot\templates\3.2.4.beta1\

In Godot:

  • Under android export > script, I set the key in the input field and
    set export mode to encrypted.
  • Under android export > options > Custom Template, I set the debug and
    release accordingly to C:/godot/bin/android_debug.apk and C:/godot/bin/android_release.apk

Then exported to android (and it crashes right after starting the game, it flickers a bit and then crashes). Adb logcat shows same errors as here. Note: it does not crash when exporting normally. Any help?

On the same link (top of the page), it says: Godot is encrypting the scripts during export, but can't read them at runtime. Well, what should I do?

in Engine by (48 points)

I see. It unfortunately did not work. I set them like this:

C:/Users/###/AppData/Roaming/Godot/templates/3.2.4.beta1/android_debug.apk

C:/Users/###AppData/Roaming/Godot/templates/3.2.4.beta1/android_release.apk

I feel like I tried almost everything. I know you're not very familiar with this, but if you do know about this, could the problem be eventually this line... set SCRIPT_AES256_ENCRYPTION_KEY=your_generated_key
I set this in the terminal before running the scons commands.

To be precise, when you set that environment variable, I assume you replaced the your_generated_key string with the actual key you generated, right?

Correct. I was just wondering if this should be done in the terminal or somewhere else. But i guess its in the terminal inside the godot source folder.

Again, just guessing... But, I assume setting it the terminal you ran all of the build commands from is exactly right. I assume the build uses that specific variable to access your custom key during the build process...

After setting the variable in a command terminal, it should be available to any process that's started from that same terminal. However, if you ran any of the commands from a different command terminal (or ran any commands before setting the variable), the encryption key would not have been available to those processes...

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories