Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.2] Fix invalid missing template error when the Android build template is not installed #46458

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions platform/android/export/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2059,14 +2059,15 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
String template_err;
bool dvalid = false;
bool rvalid = false;
bool has_export_templates = false;

if (p_preset->get("custom_template/debug") != "") {
dvalid = FileAccess::exists(p_preset->get("custom_template/debug"));
if (!dvalid) {
template_err += TTR("Custom debug template not found.") + "\n";
}
} else {
dvalid = exists_export_template("android_debug.apk", &template_err);
has_export_templates |= exists_export_template("android_debug.apk", &template_err);
}

if (p_preset->get("custom_template/release") != "") {
Expand All @@ -2075,23 +2076,25 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
template_err += TTR("Custom release template not found.") + "\n";
}
} else {
rvalid = exists_export_template("android_release.apk", &template_err);
has_export_templates |= exists_export_template("android_release.apk", &template_err);
}

valid = dvalid || rvalid;
r_missing_templates = !has_export_templates;
valid = dvalid || rvalid || has_export_templates;
if (!valid) {
err += template_err;
}
} else {
valid = exists_export_template("android_source.zip", &err);
r_missing_templates = !exists_export_template("android_source.zip", &err);

if (!FileAccess::exists("res://android/build/build.gradle")) {
bool installed_android_build_template = FileAccess::exists("res://android/build/build.gradle");
if (!installed_android_build_template) {

err += TTR("Android build template not installed in the project. Install it from the Project menu.") + "\n";
valid = false;
}

valid = installed_android_build_template && !r_missing_templates;
}
r_missing_templates = !valid;

// Validate the rest of the configuration.

Expand Down