Skip to content

Commit e3d60bb

Browse files
committed
Remove the option to compress Android native libraries
Follow-up to godotengine#106358, this is a separate commit / PR since it shouldn't be cherry-picked in previous releases as it removes existing functionality. Support for 16kb page size added in the previous PR requires the native libraries to be uncompressed, so we're deprecating and removing the option to compress native libraries. See https://developer.android.com/guide/practices/page-sizes#agp_version_851_or_higher for more details.
1 parent 5e27318 commit e3d60bb

File tree

4 files changed

+0
-38
lines changed

4 files changed

+0
-38
lines changed

platform/android/doc_classes/EditorExportPlatformAndroid.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@
5252
<member name="gradle_build/android_source_template" type="String" setter="" getter="">
5353
Path to a ZIP file holding the source for the export template used in a Gradle build. If left empty, the default template is used.
5454
</member>
55-
<member name="gradle_build/compress_native_libraries" type="bool" setter="" getter="">
56-
If [code]true[/code], native libraries are compressed when performing a Gradle build.
57-
[b]Note:[/b] Although your binary may be smaller, your application may load slower because the native libraries are not loaded directly from the binary at runtime.
58-
</member>
5955
<member name="gradle_build/export_format" type="int" setter="" getter="">
6056
Application export format (*.apk or *.aab).
6157
</member>

platform/android/export/export_plugin.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,11 +1950,6 @@ String EditorExportPlatformAndroid::get_export_option_warning(const EditorExport
19501950
if (!enabled_deprecated_plugins_names.is_empty() && !gradle_build_enabled) {
19511951
return TTR("\"Use Gradle Build\" must be enabled to use the plugins.");
19521952
}
1953-
} else if (p_name == "gradle_build/compress_native_libraries") {
1954-
bool gradle_build_enabled = p_preset->get("gradle_build/use_gradle_build");
1955-
if (bool(p_preset->get("gradle_build/compress_native_libraries")) && !gradle_build_enabled) {
1956-
return TTR("\"Compress Native Libraries\" is only valid when \"Use Gradle Build\" is enabled.");
1957-
}
19581953
} else if (p_name == "gradle_build/export_format") {
19591954
bool gradle_build_enabled = p_preset->get("gradle_build/use_gradle_build");
19601955
if (int(p_preset->get("gradle_build/export_format")) == EXPORT_FORMAT_AAB && !gradle_build_enabled) {
@@ -2026,7 +2021,6 @@ void EditorExportPlatformAndroid::get_export_options(List<ExportOption> *r_optio
20262021
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "gradle_build/use_gradle_build"), false, true, true));
20272022
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "gradle_build/gradle_build_directory", PROPERTY_HINT_PLACEHOLDER_TEXT, "res://android"), "", false, false));
20282023
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "gradle_build/android_source_template", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
2029-
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "gradle_build/compress_native_libraries"), false, false, true));
20302024
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "gradle_build/export_format", PROPERTY_HINT_ENUM, "Export APK,Export AAB"), EXPORT_FORMAT_APK, false, true));
20312025
// Using String instead of int to default to an empty string (no override) with placeholder for instructions (see GH-62465).
20322026
// This implies doing validation that the string is a proper int.
@@ -3500,7 +3494,6 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
35003494
String enabled_abi_string = join_abis(enabled_abis, "|", false);
35013495
String sign_flag = should_sign ? "true" : "false";
35023496
String zipalign_flag = "true";
3503-
String compress_native_libraries_flag = bool(p_preset->get("gradle_build/compress_native_libraries")) ? "true" : "false";
35043497

35053498
Vector<String> android_libraries;
35063499
Vector<String> android_dependencies;
@@ -3575,7 +3568,6 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
35753568
cmdline.push_back("-Pplugins_maven_repos=" + combined_android_dependencies_maven_repos); // argument to specify the list of maven repos for android dependencies provided by plugins.
35763569
cmdline.push_back("-Pperform_zipalign=" + zipalign_flag); // argument to specify whether the build should be zipaligned.
35773570
cmdline.push_back("-Pperform_signing=" + sign_flag); // argument to specify whether the build should be signed.
3578-
cmdline.push_back("-Pcompress_native_libraries=" + compress_native_libraries_flag); // argument to specify whether the build should compress native libraries.
35793571

35803572
// NOTE: The release keystore is not included in the verbose logging
35813573
// to avoid accidentally leaking sensitive information when sharing verbose logs for troubleshooting.

platform/android/java/app/build.gradle

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,6 @@ android {
132132
doNotStrip '**/*.so'
133133
}
134134

135-
jniLibs {
136-
// Setting this to true causes AGP to package compressed native libraries when building the app
137-
// For more background, see:
138-
// - https://developer.android.com/build/releases/past-releases/agp-3-6-0-release-notes#extractNativeLibs
139-
// - https://stackoverflow.com/a/44704840
140-
useLegacyPackaging shouldUseLegacyPackaging()
141-
}
142-
143135
// Always select Godot's version of libc++_shared.so in case deps have their own
144136
pickFirst 'lib/x86/libc++_shared.so'
145137
pickFirst 'lib/x86_64/libc++_shared.so'

platform/android/java/app/config.gradle

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -375,24 +375,6 @@ ext.shouldNotStrip = { ->
375375
return isAndroidStudio() || project.hasProperty("doNotStrip")
376376
}
377377

378-
/**
379-
* Whether to use the legacy convention of compressing all .so files in the APK.
380-
*
381-
* For more background, see:
382-
* - https://developer.android.com/build/releases/past-releases/agp-3-6-0-release-notes#extractNativeLibs
383-
* - https://stackoverflow.com/a/44704840
384-
*/
385-
ext.shouldUseLegacyPackaging = { ->
386-
int minSdk = getExportMinSdkVersion()
387-
String legacyPackagingFlag = project.hasProperty("compress_native_libraries") ? project.property("compress_native_libraries") : ""
388-
if (legacyPackagingFlag != null && !legacyPackagingFlag.isEmpty()) {
389-
return Boolean.parseBoolean(legacyPackagingFlag)
390-
}
391-
392-
// Default behavior for minSdk >= 24
393-
return false
394-
}
395-
396378
ext.getAddonsDirectory = { ->
397379
String addonsDirectory = project.hasProperty("addons_directory") ? project.property("addons_directory") : ""
398380
return addonsDirectory

0 commit comments

Comments
 (0)