I need help setting Android environment variables for headless CLI builds

Godot Version

v4.3.stable.official [77dcf97d8] (Windows)

Question

Hi all, I’m guessing I’m doing something wrong.

I can run automated Android exports using the Godot CLI. Debug builds are working fine, but I am unable to get signing working with my release keystore. Per the docs I should be able to set up the keystore path and user/password using CLI environment variables. It appears that Godot isn’t using the variables I’m setting, which leads me to think I’m setting the variables incorrectly.

I am able to get headless Android builds working without the environment variables by using editor settings in the .godot folder, but I am trying to set this up for CI/CD and would prefer to use the environment-variable-based functionality.

Note: I am using Godots for my engine version management, so I’m not calling a godot alias. However, all other exports are working fine through CLI, so I don’t think it’s related to the way I’m calling the binary.

Here’s the PowerShell script I’m trying to use:

$GODOT_ANDROID_KEYSTORE_RELEASE_PATH="<valid absolute path including the keystore filename>"
$GODOT_ANDROID_KEYSTORE_RELEASE_USER="<user>"
$GODOT_ANDROID_KEYSTORE_RELEASE_PASSWORD="<pass>"

<absolute path to Godot directory>\Godot_v4.3-stable_win64.exe --quit --headless --export-release "Android"

It creates the APK properly, then produces the following output during the signing step:

        export: step 1: Adding files...
        export: step 103: Aligning APK...
        export: step 104: Signing release APK...
WARNING: Code Signing: Could not find keystore, unable to export.
     at: add_message (editor/export/editor_export_platform.h:179)
export: end
ERROR: Project export for preset "Android" failed.
   at: _fs_changed (editor/editor_node.cpp:1028)

I’ve been stuck here for a while & hoping someone can spot what I’m doing wrong – any advice?

I was doing several things wrong.

  • The PowerShell variables needed to be set as environment variables with a format like $env:GODOT_ANDROID_KEYSTORE_RELEASE_PATH. It seems like I was just setting regular variables & Godot wasn’t picking them up.
  • Similarly, my Linux exports weren’t picking them up because I hadn’t used the export keyword on the variable (e.g. export GODOT_ANDROID_KEYSTORE_RELEASE_PATH="<path>").
  • I was also using relative paths in my GitHub workflow, which caused the keystore to not be found. Absolute paths (e.g. using ${{ github.workspace }}) work properly.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.