java_resource_extractor exclusion lists miss entries that AGP strips by default (KMP klib metadata, root LICENSE/NOTICE files)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Domain
- build-system, mobile
Research direction
Start in src/tools/java_resource_extractor/resource_extractor.py by reading the existing resource exclusion lists and comparing them with the entries named in the issue. Update the filtering so .knm, .kotlin_metadata, linkdata/, and root LICENSE.txt/NOTICE.txt are excluded, while META-INF/*.kotlin_module remains included; verify the resulting APK contents.
Written by the indexing model from the issue text.
Description
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/*)- root-level
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: https://github.com/Dolfik1/rules_android/commit/ead968493476d45059224949ec2536755b1a8aab
Happy to send this as a PR.
- Dominant language
- Java
- Stars
- 203
- Forks
- 95
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bazelbuild/rules_android
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
bazelbuild/rules_android#539 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bazelbuild/rules_android#485 · 4 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
bazelbuild/rules_android#564 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
bazelbuild/rules_android#560 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
bazelbuild/rules_android#558 ·
All issues in bazelbuild/rules_android
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100