mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
Bump the minimum supported SDK version to 24
Raise the minimum supported Android version from Android 5 (Lollipop) to Android 7 (Nougat).
This commit is contained in:
parent
8f78e7510d
commit
c29545f793
15 changed files with 96 additions and 180 deletions
|
@ -281,8 +281,7 @@ static const int EXPORT_FORMAT_AAB = 1;
|
|||
static const char *APK_ASSETS_DIRECTORY = "assets";
|
||||
static const char *AAB_ASSETS_DIRECTORY = "assetPacks/installTime/src/main/assets";
|
||||
|
||||
static const int OPENGL_MIN_SDK_VERSION = 21; // Should match the value in 'platform/android/java/app/config.gradle#minSdk'
|
||||
static const int VULKAN_MIN_SDK_VERSION = 24;
|
||||
static const int DEFAULT_MIN_SDK_VERSION = 24; // Should match the value in 'platform/android/java/app/config.gradle#minSdk'
|
||||
static const int DEFAULT_TARGET_SDK_VERSION = 35; // Should match the value in 'platform/android/java/app/config.gradle#targetSdk'
|
||||
|
||||
#ifndef ANDROID_ENABLED
|
||||
|
@ -1963,7 +1962,6 @@ String EditorExportPlatformAndroid::get_export_option_warning(const EditorExport
|
|||
}
|
||||
} else if (p_name == "gradle_build/min_sdk") {
|
||||
String min_sdk_str = p_preset->get("gradle_build/min_sdk");
|
||||
int min_sdk_int = VULKAN_MIN_SDK_VERSION;
|
||||
bool gradle_build_enabled = p_preset->get("gradle_build/use_gradle_build");
|
||||
if (!min_sdk_str.is_empty()) { // Empty means no override, nothing to do.
|
||||
if (!gradle_build_enabled) {
|
||||
|
@ -1972,9 +1970,9 @@ String EditorExportPlatformAndroid::get_export_option_warning(const EditorExport
|
|||
if (!min_sdk_str.is_valid_int()) {
|
||||
return vformat(TTR("\"Min SDK\" should be a valid integer, but got \"%s\" which is invalid."), min_sdk_str);
|
||||
} else {
|
||||
min_sdk_int = min_sdk_str.to_int();
|
||||
if (min_sdk_int < OPENGL_MIN_SDK_VERSION) {
|
||||
return vformat(TTR("\"Min SDK\" cannot be lower than %d, which is the version needed by the Godot library."), OPENGL_MIN_SDK_VERSION);
|
||||
int min_sdk_int = min_sdk_str.to_int();
|
||||
if (min_sdk_int < DEFAULT_MIN_SDK_VERSION) {
|
||||
return vformat(TTR("\"Min SDK\" cannot be lower than %d, which is the version needed by the Godot library."), DEFAULT_MIN_SDK_VERSION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1983,7 +1981,7 @@ String EditorExportPlatformAndroid::get_export_option_warning(const EditorExport
|
|||
int target_sdk_int = DEFAULT_TARGET_SDK_VERSION;
|
||||
|
||||
String min_sdk_str = p_preset->get("gradle_build/min_sdk");
|
||||
int min_sdk_int = VULKAN_MIN_SDK_VERSION;
|
||||
int min_sdk_int = DEFAULT_MIN_SDK_VERSION;
|
||||
if (min_sdk_str.is_valid_int()) {
|
||||
min_sdk_int = min_sdk_str.to_int();
|
||||
}
|
||||
|
@ -2032,7 +2030,7 @@ void EditorExportPlatformAndroid::get_export_options(List<ExportOption> *r_optio
|
|||
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "gradle_build/export_format", PROPERTY_HINT_ENUM, "Export APK,Export AAB"), EXPORT_FORMAT_APK, false, true));
|
||||
// Using String instead of int to default to an empty string (no override) with placeholder for instructions (see GH-62465).
|
||||
// This implies doing validation that the string is a proper int.
|
||||
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "gradle_build/min_sdk", PROPERTY_HINT_PLACEHOLDER_TEXT, vformat("%d (default)", VULKAN_MIN_SDK_VERSION)), "", false, true));
|
||||
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "gradle_build/min_sdk", PROPERTY_HINT_PLACEHOLDER_TEXT, vformat("%d (default)", DEFAULT_MIN_SDK_VERSION)), "", false, true));
|
||||
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "gradle_build/target_sdk", PROPERTY_HINT_PLACEHOLDER_TEXT, vformat("%d (default)", DEFAULT_TARGET_SDK_VERSION)), "", false, true));
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
|
@ -2903,14 +2901,6 @@ bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<Edit
|
|||
}
|
||||
}
|
||||
|
||||
String min_sdk_str = p_preset->get("gradle_build/min_sdk");
|
||||
int min_sdk_int = VULKAN_MIN_SDK_VERSION;
|
||||
if (!min_sdk_str.is_empty()) { // Empty means no override, nothing to do.
|
||||
if (min_sdk_str.is_valid_int()) {
|
||||
min_sdk_int = min_sdk_str.to_int();
|
||||
}
|
||||
}
|
||||
|
||||
String target_sdk_str = p_preset->get("gradle_build/target_sdk");
|
||||
int target_sdk_int = DEFAULT_TARGET_SDK_VERSION;
|
||||
if (!target_sdk_str.is_empty()) { // Empty means no override, nothing to do.
|
||||
|
@ -2931,12 +2921,6 @@ bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<Edit
|
|||
err += "\n";
|
||||
}
|
||||
|
||||
if (_uses_vulkan(p_preset) && min_sdk_int < VULKAN_MIN_SDK_VERSION) {
|
||||
// Warning only, so don't override `valid`.
|
||||
err += vformat(TTR("\"Min SDK\" should be greater or equal to %d for the \"%s\" renderer."), VULKAN_MIN_SDK_VERSION, current_renderer);
|
||||
err += "\n";
|
||||
}
|
||||
|
||||
String package_name = p_preset->get("package/unique_name");
|
||||
if (package_name.contains("$genname") && !is_project_name_valid(p_preset)) {
|
||||
// Warning only, so don't override `valid`.
|
||||
|
@ -3507,7 +3491,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
|
|||
String version_name = p_preset->get_version("version/name");
|
||||
String min_sdk_version = p_preset->get("gradle_build/min_sdk");
|
||||
if (!min_sdk_version.is_valid_int()) {
|
||||
min_sdk_version = itos(VULKAN_MIN_SDK_VERSION);
|
||||
min_sdk_version = itos(DEFAULT_MIN_SDK_VERSION);
|
||||
}
|
||||
String target_sdk_version = p_preset->get("gradle_build/target_sdk");
|
||||
if (!target_sdk_version.is_valid_int()) {
|
||||
|
@ -3947,6 +3931,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
|
|||
|
||||
// Let's zip-align (must be done before signing)
|
||||
|
||||
static const int PAGE_SIZE_KB = 16 * 1024;
|
||||
static const int ZIP_ALIGNMENT = 4;
|
||||
|
||||
// If we're not signing the apk, then the next step should be the last.
|
||||
|
@ -3998,7 +3983,12 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
|
|||
if (!info.compression_method) {
|
||||
// Uncompressed file => Align
|
||||
long new_offset = file_offset + bias;
|
||||
padding = (ZIP_ALIGNMENT - (new_offset % ZIP_ALIGNMENT)) % ZIP_ALIGNMENT;
|
||||
const char *ext = strrchr(fname, '.');
|
||||
if (ext && strcmp(ext, ".so") == 0) {
|
||||
padding = (PAGE_SIZE_KB - (new_offset % PAGE_SIZE_KB)) % PAGE_SIZE_KB;
|
||||
} else {
|
||||
padding = (ZIP_ALIGNMENT - (new_offset % ZIP_ALIGNMENT)) % ZIP_ALIGNMENT;
|
||||
}
|
||||
}
|
||||
|
||||
memset(extra + info.size_file_extra, 0, padding);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue