src/tools/java_resource_extractor/resource_extractor.py filters out well-known junk from java resources, but its exclusion lists miss a few things that AGP's default packaging rules strip, so they end up in the final APK:
.knm files (Kotlin/Native klib metadata)
.kotlin_metadata files
linkdata/ directories (e.g. commonMain/.../linkdata/*)
- root-level
LICENSE.txt / NOTICE.txt from library jars (the META-INF copies are already covered by the meta-inf directory exclusion)
The klib metadata is only consumed by the Kotlin compiler when compiling against a library; nothing reads it at runtime, so in an APK it's dead weight. In the Gradle world it's common to exclude it via packaging options on top of AGP's defaults. With a KMP-heavy dependency tree (kotlinx-*, androidx KMP artifacts) it adds up — on our app stripping all of the above saved ~0.45 MiB uncompressed (~0.24 MiB compressed).
This deliberately does not touch META-INF/*.kotlin_module, which kotlin-reflect needs at runtime.
Patch: Dolfik1@ead9684
Happy to send this as a PR.
src/tools/java_resource_extractor/resource_extractor.py filters out well-known junk from java resources, but its exclusion lists miss a few things that AGP's default packaging rules strip, so they end up in the final APK:
.knmfiles (Kotlin/Native klib metadata).kotlin_metadatafileslinkdata/directories (e.g.commonMain/.../linkdata/*)LICENSE.txt/NOTICE.txtfrom library jars (the META-INF copies are already covered by the meta-inf directory exclusion)The klib metadata is only consumed by the Kotlin compiler when compiling against a library; nothing reads it at runtime, so in an APK it's dead weight. In the Gradle world it's common to exclude it via packaging options on top of AGP's defaults. With a KMP-heavy dependency tree (kotlinx-*, androidx KMP artifacts) it adds up — on our app stripping all of the above saved ~0.45 MiB uncompressed (~0.24 MiB compressed).
This deliberately does not touch
META-INF/*.kotlin_module, which kotlin-reflect needs at runtime.Patch: Dolfik1@ead9684
Happy to send this as a PR.