Status Update
Comments
al...@google.com <al...@google.com> #2
Retraced stack trace:
Caused by: java.lang.UnsupportedOperationException: Operation is not supported for read-only collection
at com.android.tools.r8.jetbrains.kotlin.collections.EmptyList.removeAll(Collections.kt)
at com.android.tools.r8.resourceshrinker.r8integration.LegacyResourceShrinker.run(LegacyResourceShrinker.java:228)
at com.android.tools.r8.R8.shrinkResources(R8.java:991)
at com.android.tools.r8.R8.runInternal(R8.java:894)
at com.android.tools.r8.R8.runInternal(R8.java:259)
at com.android.tools.r8.R8.lambda$runForTesting$1(R8.java:243)
at com.android.tools.r8.internal.Nu.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:28
ja...@gmail.com <ja...@gmail.com> #3
This is happening when there are no unused resources at all and we have duplicated resources between the feature and base (or different features)
Reproduction here:
Fix here:
For the reporter to work around this:
- Disable resource shrinking in this case, it will have no effect since there are no unused resources for this build
- Use legacy AGP embedded shrinker - set android.r8.integratedResourceShrinking false in your settings
- Manually update to a new R8 version (I will post a follow up when this is on our release branch)
em...@google.com <em...@google.com>
je...@google.com <je...@google.com>
ja...@gmail.com <ja...@gmail.com> #5
Project: r8
Branch: main
Author: Rico Wind <
Link:
Fix usage of Immutable list in resource shrinker
Expand for full commit details
Fix usage of Immutable list in resource shrinker
The returned list is mutable unless it is empty, allways create a copy.
Bug: b/401546693
Change-Id: I9ea50d23c365ea59e1f6ae5e13a02048daa8b5f8
Files:
- M
src/resourceshrinker/java/com/android/build/shrinker/r8integration/LegacyResourceShrinker.java
- M
src/test/java/com/android/tools/r8/androidresources/DuplicatedEntriesEmptyUnusedTest.java
Hash: dc5cae852ee11d42456d275afb1837d1f770306f
Date: Mon Mar 10 17:56:18 2025
bi...@google.com <bi...@google.com> #6
Project: r8
Branch: main
Author: Rico Wind <
Link:
Add reproduction of adding to immutable list in resource shrinker
Expand for full commit details
Add reproduction of adding to immutable list in resource shrinker
This happens if the list returned from the model is empty, in which case it is immutable
Bug: b/401546693
Change-Id: Ib596242df6e3299f19ff00a03dbe43bde79e13c0
Files:
- A
src/test/java/com/android/tools/r8/androidresources/DuplicatedEntriesEmptyUnusedTest.java
Hash: 429ddad6ffce418ebaf482277ee8e96a68ab18e4
Date: Mon Mar 10 17:51:07 2025
bi...@google.com <bi...@google.com> #7
Project: r8
Branch: 8.9
Author: Rico Wind <
Link:
Add reproduction of adding to immutable list in resource shrinker
Expand for full commit details
Add reproduction of adding to immutable list in resource shrinker
This happens if the list returned from the model is empty, in which case it is immutable
Bug: b/401546693
Change-Id: Ib596242df6e3299f19ff00a03dbe43bde79e13c0
Files:
- A
src/test/java/com/android/tools/r8/androidresources/DuplicatedEntriesEmptyUnusedTest.java
Hash: 2f90d4133d2af07c954dceddb1ae47cc28e7b9d8
Date: Tue Mar 11 10:54:07 2025
ja...@gmail.com <ja...@gmail.com> #8
Project: r8
Branch: 8.9
Author: Rico Wind <
Link:
Fix usage of Immutable list in resource shrinker
Expand for full commit details
Fix usage of Immutable list in resource shrinker
The returned list is mutable unless it is empty, allways create a copy.
Bug: b/401546693
Change-Id: I9ea50d23c365ea59e1f6ae5e13a02048daa8b5f8
Files:
- M
src/resourceshrinker/java/com/android/build/shrinker/r8integration/LegacyResourceShrinker.java
- M
src/test/java/com/android/tools/r8/androidresources/DuplicatedEntriesEmptyUnusedTest.java
Hash: 5e687ec23a4cdb897cbd2cdccc75ff956d99c88c
Date: Tue Mar 11 10:54:12 2025
Description
When creating a library component that uses here , it states:
@IntDef
annotations in its public API, I am expecting that theannotations.zip
is packaged inside that aar - fromHowever, this doesn't appear to be the case, and the
build/intermediates/annotations_typedef_file/debug/typedefs.txt
file is empty (I'm assuming this would contain something?) as is thebuild/intermediates/annotations_zip/debug/
dir.I'm using AGP 7.0.3 with Gradle version 7.0.2 in Android Studio Bumblebee 2021.1.1. Patch 2.
(NOTE: I re-raised this ticket, as https://issuetracker.google.com/issues/227147440 was likely in too high-level a bucket. Apologies for the dupe.)