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
This commit is contained in:
stevenyomi 2024-06-03 20:52:59 +08:00 committed by GitHub
parent a1edef99a2
commit 95c1fe5c1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -63,6 +63,7 @@ android {
release { release {
signingConfig signingConfigs.release signingConfig signingConfigs.release
minifyEnabled false minifyEnabled false
vcsInfo.include false
} }
} }
@ -74,6 +75,10 @@ android {
buildConfig true buildConfig true
} }
packaging {
resources.excludes.add("kotlin-tooling-metadata.json")
}
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8