From e65117d8779d485f6a418dc00b73bc7e43a026d3 Mon Sep 17 00:00:00 2001 From: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Date: Mon, 3 Jun 2024 20:52:59 +0800 Subject: [PATCH] Remove unnecessary files in generated APKs (#3383) * Removed `kotlin-tooling-metadata.json`, see https://togithub.com/Kotlin/kotlinx.coroutines/issues/3158#issuecomment-1023151105 This file includes Gradle version code, so Gradle updates will no longer cause binary changes. * Removed "META-INF/version-control-info.textproto" introduced in AGP 8.4.1, which causes the binaries to change on each commit. AGP updates will still cause binaries changes because it produces a required `app-metadata.properties` under `META-INF`, and the `META-INF/MANIFEST.MF` file in the signature includes AGP version. It is possible to empty `app-metadata.properties`: https://stackoverflow.com/questions/77745443/how-to-stop-gradle-from-generating-app-metadata-properties-at-compile-time --- common.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common.gradle b/common.gradle index 73abf50c4..f0e8f29a2 100644 --- a/common.gradle +++ b/common.gradle @@ -63,6 +63,7 @@ android { release { signingConfig signingConfigs.release minifyEnabled false + vcsInfo.include false } } @@ -74,6 +75,10 @@ android { buildConfig true } + packaging { + resources.excludes.add("kotlin-tooling-metadata.json") + } + compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8