Fixed
Status Update
Comments
jh...@gmail.com <jh...@gmail.com>
jh...@gmail.com <jh...@gmail.com> #2
Can you use the workaround described at
ch...@google.com <ch...@google.com>
na...@vitruvian.me <na...@vitruvian.me> #3
Using 8.4.40 or 8.5.26 cannot fix the issue.
8.3.51 is not found.
Using 8.3.37 from
ri...@google.com <ri...@google.com> #4
From
@Søren: Could you triage this issue?
ri...@google.com <ri...@google.com> #5
Thanks for taking the time to create a reproduction. I reproduced the issue and confirmed that the issue is still present on main (R8 8.6). I will land a fix soon and backport the fix to the relevant release branches.
jh...@gmail.com <jh...@gmail.com> #6
Project: r8
Branch: main
commit 7803ec93afef8bf1047eaf8f209fdbe81bdbd581
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 08:39:10 2024
Reproduce IAE from instance field merging
Bug: b/347676160
Change-Id: I0614da65d0a60f7f2d01d6a8aa92b9cadfabe005
A src/test/java/com/android/tools/r8/classmerging/horizontal/InaccessibleFieldTypeMergingTest.java
A src/test/java/com/android/tools/r8/classmerging/horizontal/testclasses/InaccessibleFieldTypeMergingTestClasses.java
https://r8-review.googlesource.com/94140
Branch: main
commit 7803ec93afef8bf1047eaf8f209fdbe81bdbd581
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 08:39:10 2024
Reproduce IAE from instance field merging
Bug:
Change-Id: I0614da65d0a60f7f2d01d6a8aa92b9cadfabe005
A src/test/java/com/android/tools/r8/classmerging/horizontal/InaccessibleFieldTypeMergingTest.java
A src/test/java/com/android/tools/r8/classmerging/horizontal/testclasses/InaccessibleFieldTypeMergingTestClasses.java
jh...@gmail.com <jh...@gmail.com> #7
Project: r8
Branch: main
commit 9ea42409d593d89dce0184f00728ccd46ba5e7a3
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 12:48:42 2024
Disallow class merging when instance field merging may lead to IAE
Bug: b/347676160
Change-Id: I521dc342150e8374992dd453379915e8a5e36db8
M src/main/java/com/android/tools/r8/shaking/Enqueuer.java
M src/test/java/com/android/tools/r8/classmerging/horizontal/InaccessibleFieldTypeMergingTest.java
https://r8-review.googlesource.com/94142
Branch: main
commit 9ea42409d593d89dce0184f00728ccd46ba5e7a3
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 12:48:42 2024
Disallow class merging when instance field merging may lead to IAE
Bug:
Change-Id: I521dc342150e8374992dd453379915e8a5e36db8
M src/main/java/com/android/tools/r8/shaking/Enqueuer.java
M src/test/java/com/android/tools/r8/classmerging/horizontal/InaccessibleFieldTypeMergingTest.java
ri...@google.com <ri...@google.com> #8
Project: r8
Branch: 8.5
commit e58b343a1aa4631008946e21ca3d00a8f151ae5e
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 13:38:13 2024
Disallow class merging when instance field merging may lead to IAE
Bug: b/347676160
Change-Id: I521dc342150e8374992dd453379915e8a5e36db8
M src/main/java/com/android/tools/r8/shaking/Enqueuer.java
M src/test/java/com/android/tools/r8/classmerging/horizontal/InaccessibleFieldTypeMergingTest.java
https://r8-review.googlesource.com/94161
Branch: 8.5
commit e58b343a1aa4631008946e21ca3d00a8f151ae5e
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 13:38:13 2024
Disallow class merging when instance field merging may lead to IAE
Bug:
Change-Id: I521dc342150e8374992dd453379915e8a5e36db8
M src/main/java/com/android/tools/r8/shaking/Enqueuer.java
M src/test/java/com/android/tools/r8/classmerging/horizontal/InaccessibleFieldTypeMergingTest.java
ri...@google.com <ri...@google.com> #9
Project: r8
Branch: 8.5
commit fe6ed811fc69f65b9cb62a4279b62f03d1cd1715
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 13:38:23 2024
Version 8.5.31
Bug: b/347676160
Change-Id: I1b2ece43a23b871c99d9cb8b70c29c50468752bb
M src/main/java/com/android/tools/r8/Version.java
https://r8-review.googlesource.com/94124
Branch: 8.5
commit fe6ed811fc69f65b9cb62a4279b62f03d1cd1715
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 13:38:23 2024
Version 8.5.31
Bug:
Change-Id: I1b2ece43a23b871c99d9cb8b70c29c50468752bb
M src/main/java/com/android/tools/r8/Version.java
ri...@google.com <ri...@google.com> #10
Project: r8
Branch: 8.5
commit b5bc5b7266a51184e0ca97e6e9342766e51b8a1d
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 13:37:59 2024
Reproduce IAE from instance field merging
Bug: b/347676160
Change-Id: I0614da65d0a60f7f2d01d6a8aa92b9cadfabe005
A src/test/java/com/android/tools/r8/classmerging/horizontal/InaccessibleFieldTypeMergingTest.java
A src/test/java/com/android/tools/r8/classmerging/horizontal/testclasses/InaccessibleFieldTypeMergingTestClasses.java
https://r8-review.googlesource.com/94160
Branch: 8.5
commit b5bc5b7266a51184e0ca97e6e9342766e51b8a1d
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 13:37:59 2024
Reproduce IAE from instance field merging
Bug:
Change-Id: I0614da65d0a60f7f2d01d6a8aa92b9cadfabe005
A src/test/java/com/android/tools/r8/classmerging/horizontal/InaccessibleFieldTypeMergingTest.java
A src/test/java/com/android/tools/r8/classmerging/horizontal/testclasses/InaccessibleFieldTypeMergingTestClasses.java
ga...@google.com <ga...@google.com>
ga...@google.com <ga...@google.com> #11
Project: r8
Branch: 8.4
commit 4c848f3563562011b284484a2f60c0f0a4a020d1
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 13:42:06 2024
Version 8.4.42
Bug: b/347676160
Change-Id: I5239ceba9bd57249447ef5f140f8122924d5513a
M src/main/java/com/android/tools/r8/Version.java
https://r8-review.googlesource.com/94163
Branch: 8.4
commit 4c848f3563562011b284484a2f60c0f0a4a020d1
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 13:42:06 2024
Version 8.4.42
Bug:
Change-Id: I5239ceba9bd57249447ef5f140f8122924d5513a
M src/main/java/com/android/tools/r8/Version.java
cm...@google.com <cm...@google.com>
cm...@google.com <cm...@google.com> #12
Project: r8
Branch: 8.4
commit b4c22c95d196d99507fa9c6fea954cf5f215662c
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 13:41:52 2024
Disallow class merging when instance field merging may lead to IAE
Bug: b/347676160
Change-Id: I521dc342150e8374992dd453379915e8a5e36db8
M src/main/java/com/android/tools/r8/shaking/Enqueuer.java
M src/test/java/com/android/tools/r8/classmerging/horizontal/InaccessibleFieldTypeMergingTest.java
https://r8-review.googlesource.com/94125
Branch: 8.4
commit b4c22c95d196d99507fa9c6fea954cf5f215662c
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Fri Jun 28 13:41:52 2024
Disallow class merging when instance field merging may lead to IAE
Bug:
Change-Id: I521dc342150e8374992dd453379915e8a5e36db8
M src/main/java/com/android/tools/r8/shaking/Enqueuer.java
M src/test/java/com/android/tools/r8/classmerging/horizontal/InaccessibleFieldTypeMergingTest.java
Description
When certain build features are used together, the resource shrinker mangles resource IDs. Resource ID integers in the resulting binary are wrong, which at runtime leads either to
The behavior is not totally deterministic - some builds are fine, but sometimes, renaming the XML resource is enough (!) to get the crash. Sometimes, a clean build, AS restart, or invalidate caches & restart command fixes things, but only temporarily, until the next rename.
To reproduce, please run the attached project, distilled from a real-world project:
R.string.sample_string_resource
resource to anything else, and try again.android.content.res.Resources$NotFoundException: String resource ID #0x7f0d0027
(full stack trace below).The issue can be mitigated by not using certain build features. Each one of the following fixes the problem independently:
isShrinkResources = false
.resourceConfigurations += "en"
.settings.gradle.kts
andbuild.gradle.kts
).Notes:
Thanks, and let me know if I can help further. 🙏
Full stack trace:
System info: