diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index 14160878c8..d327af2076 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -3586,6 +3586,30 @@ Error EditorExportPlatformAndroid::_generate_sparse_pck_metadata(const Ref temp_file = FileAccess::open(temp_filename, FileAccess::WRITE); + if (!temp_file.is_valid()) { + return String(); + } + + temp_file->store_buffer(keystore_data); + return temp_filename; +} +#endif + Error EditorExportPlatformAndroid::export_project_helper(const Ref &p_preset, bool p_debug, const String &p_path, int export_format, bool should_sign, BitField p_flags) { ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags); @@ -3894,22 +3918,13 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref temp_file = FileAccess::open(temp_filename, FileAccess::WRITE); - if (temp_file.is_valid()) { - temp_file->store_buffer(keystore_data); - debug_keystore = temp_filename; - } - } + // The GABE app only has access to the project directory. + // Since the keystore can be anywhere in the filesystem, so we need to copy this to temp file. + String new_debug_keystore = _copy_keystore_to_temp(debug_keystore, build_path, "debug.keystore"); + if (new_debug_keystore.is_empty()) { + add_message(EXPORT_MESSAGE_ERROR, TTR("Code Signing"), TTR("Failed to copy debug keystore to temp directory.")); + } else { + debug_keystore = new_debug_keystore; } #endif @@ -3928,6 +3943,16 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref