Android: Only validate keystore relevant to current export mode

- Debug builds skip release keystore validation.
- Release builds skip debug keystore validation.

(cherry picked from commit 097ccbc5cd)
This commit is contained in:
Anish Mishra 2025-08-13 13:35:50 +05:30 committed by Rémi Verschelde
parent eb7c869f84
commit d632731ba8
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -2853,6 +2853,7 @@ bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<Edito
// Validate the rest of the export configuration. // Validate the rest of the export configuration.
if (p_debug) {
String dk = _get_keystore_path(p_preset, true); String dk = _get_keystore_path(p_preset, true);
String dk_user = p_preset->get_or_env("keystore/debug_user", ENV_ANDROID_KEYSTORE_DEBUG_USER); String dk_user = p_preset->get_or_env("keystore/debug_user", ENV_ANDROID_KEYSTORE_DEBUG_USER);
String dk_password = p_preset->get_or_env("keystore/debug_password", ENV_ANDROID_KEYSTORE_DEBUG_PASS); String dk_password = p_preset->get_or_env("keystore/debug_password", ENV_ANDROID_KEYSTORE_DEBUG_PASS);
@ -2863,14 +2864,14 @@ bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<Edito
} }
// Use OR to make the export UI able to show this error. // Use OR to make the export UI able to show this error.
if ((p_debug || !dk.is_empty()) && !FileAccess::exists(dk)) { if (!dk.is_empty() && !FileAccess::exists(dk)) {
dk = EDITOR_GET("export/android/debug_keystore"); dk = EDITOR_GET("export/android/debug_keystore");
if (!FileAccess::exists(dk)) { if (!FileAccess::exists(dk)) {
valid = false; valid = false;
err += TTR("Debug keystore not configured in the Editor Settings nor in the preset.") + "\n"; err += TTR("Debug keystore not configured in the Editor Settings nor in the preset.") + "\n";
} }
} }
} else {
String rk = _get_keystore_path(p_preset, false); String rk = _get_keystore_path(p_preset, false);
String rk_user = p_preset->get_or_env("keystore/release_user", ENV_ANDROID_KEYSTORE_RELEASE_USER); String rk_user = p_preset->get_or_env("keystore/release_user", ENV_ANDROID_KEYSTORE_RELEASE_USER);
String rk_password = p_preset->get_or_env("keystore/release_password", ENV_ANDROID_KEYSTORE_RELEASE_PASS); String rk_password = p_preset->get_or_env("keystore/release_password", ENV_ANDROID_KEYSTORE_RELEASE_PASS);
@ -2880,10 +2881,11 @@ bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<Edito
err += TTR("Either Release Keystore, Release User AND Release Password settings must be configured OR none of them.") + "\n"; err += TTR("Either Release Keystore, Release User AND Release Password settings must be configured OR none of them.") + "\n";
} }
if (!p_debug && !rk.is_empty() && !FileAccess::exists(rk)) { if (!rk.is_empty() && !FileAccess::exists(rk)) {
valid = false; valid = false;
err += TTR("Release keystore incorrectly configured in the export preset.") + "\n"; err += TTR("Release keystore incorrectly configured in the export preset.") + "\n";
} }
}
#ifndef ANDROID_ENABLED #ifndef ANDROID_ENABLED
String java_sdk_path = EDITOR_GET("export/android/java_sdk_path"); String java_sdk_path = EDITOR_GET("export/android/java_sdk_path");