Status Update
Comments
sg...@google.com <sg...@google.com> #2
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Ladybug Feature Drop | 2024.2.2 Canary 3
- Android Gradle Plugin 8.8.0-alpha03
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
Er...@gtempaccount.com <Er...@gtempaccount.com> #3
Hi thank you for the reply.
I forgot to mention this. In the real project, we do have a special presenter class that is created via reflection because its one screen (a fragment) that instantiates a unique presenter via reflection. This presenter had the same countdown logic which was the only case that actually crashed. I just replicated that case on a small scale.
I can add keep rules for each case but I wanted to check if there was an issue because I have R8 full mode disabled so as far as I know the default constructor shouldn't be removed and this issue only appeared after updating AGP.
ap...@google.com <ap...@google.com> #4
Project: r8
Branch: main
Author: Søren Gjesse <
Link:
Reproduce
Expand for full commit details
Reproduce issue 387258081
Reflective identification of instantiation fails to keep the
instantiated class.
Bug: b/387258081
Change-Id: I79a6f418564beb6fbd2b0f70536ec8d6cee4f1a0
Files:
- M
src/test/java/com/android/tools/r8/shaking/reflection/ReflectiveNewInstanceTest.java
Hash: c26443cf0b0addd138818855f3387381414d6848
Date: Wed Jan 08 14:26:13 2025
ap...@google.com <ap...@google.com> #5
Project: r8
Branch: main
Author: Søren Gjesse <
Link:
Keep the instantiated class when identifying reflective construction
Expand for full commit details
Keep the instantiated class when identifying reflective construction
Fixes: b/387258081
Change-Id: Icad6778099e247c3f045b94f182ab217949a1d28
Files:
- M
src/main/java/com/android/tools/r8/shaking/Enqueuer.java
- M
src/test/java/com/android/tools/r8/shaking/reflection/ReflectiveNewInstanceTest.java
Hash: cfa130c5387e3cb826b414f84f7a7572b3275bf1
Date: Wed Jan 08 14:31:49 2025
ap...@google.com <ap...@google.com> #6
Project: r8
Branch: 8.8
Author: Søren Gjesse <
Link:
Reproduce
Expand for full commit details
Reproduce issue 387258081
Reflective identification of instantiation fails to keep the
instantiated class.
R=christofferqa@google.com
Bug: b/387258081
Change-Id: I79a6f418564beb6fbd2b0f70536ec8d6cee4f1a0
Files:
- M
src/test/java/com/android/tools/r8/shaking/reflection/ReflectiveNewInstanceTest.java
Hash: c5ae16ad9f249287ccce5bb3ec2e0d39831be942
Date: Mon Jan 13 09:44:18 2025
ap...@google.com <ap...@google.com> #7
Project: r8
Branch: 8.8
Author: Søren Gjesse <
Link:
Keep the instantiated class when identifying reflective construction
Expand for full commit details
Keep the instantiated class when identifying reflective construction
R=christofferqa@google.com
Fixes: b/387258081
Change-Id: Icad6778099e247c3f045b94f182ab217949a1d28
Files:
- M
src/main/java/com/android/tools/r8/shaking/Enqueuer.java
- M
src/test/java/com/android/tools/r8/shaking/reflection/ReflectiveNewInstanceTest.java
Hash: 1e1c947018d98d18a25a4fe0f17c1873f2bd75c7
Date: Mon Jan 13 09:44:26 2025
ap...@google.com <ap...@google.com> #8
Project: r8
Branch: 8.8
Author: Søren Gjesse <
Link:
Version 8.8.26
Expand for full commit details
Version 8.8.26
R=christofferqa@google.com
Bug: b/387258081
Change-Id: Ia56f0d4917a0e0a635ea92aa1331b14f2b17a750
Files:
- M
src/main/java/com/android/tools/r8/Version.java
Hash: 2c19e8564d030f2977c8902523bd2ec805b53362
Date: Mon Jan 13 09:44:33 2025
ap...@google.com <ap...@google.com> #9
Project: r8
Branch: 8.7
Author: Søren Gjesse <
Link:
Reproduce
Expand for full commit details
Reproduce issue 387258081
Reflective identification of instantiation fails to keep the
instantiated class.
R=christofferqa@google.com
Bug: b/387258081
Change-Id: I79a6f418564beb6fbd2b0f70536ec8d6cee4f1a0
Files:
- M
src/test/java/com/android/tools/r8/shaking/reflection/ReflectiveNewInstanceTest.java
Hash: 2b7b08765250df9f88f85f9f3138a5d975e84db7
Date: Mon Jan 13 09:58:11 2025
ap...@google.com <ap...@google.com> #10
Project: r8
Branch: 8.7
Author: Søren Gjesse <
Link:
Keep the instantiated class when identifying reflective construction
Expand for full commit details
Keep the instantiated class when identifying reflective construction
R=christofferqa@google.com
Fixes: b/387258081
Change-Id: Icad6778099e247c3f045b94f182ab217949a1d28
Files:
- M
src/main/java/com/android/tools/r8/shaking/Enqueuer.java
- M
src/test/java/com/android/tools/r8/shaking/reflection/ReflectiveNewInstanceTest.java
Hash: 7f7db9041a6c14f27c1aacc808374c968e39faf8
Date: Mon Jan 13 09:58:18 2025
ap...@google.com <ap...@google.com> #11
Project: r8
Branch: 8.7
Author: Søren Gjesse <
Link:
Version 8.7.28
Expand for full commit details
Version 8.7.28
R=christofferqa@google.com
Bug: b/387258081
Change-Id: I72cc81fbfb033dad6a78d61c3d9b392c7c326a7f
Files:
- M
src/main/java/com/android/tools/r8/Version.java
Hash: fdf74442918c2100d22c5bbb3c185044a58144cf
Date: Mon Jan 13 09:58:25 2025
sg...@google.com <sg...@google.com> #12
Thank you for the reply. It is true that compat mode does not remove the default constructor when classes are not removed, and looking at the output from the compiler the CountdownHelper
was still present with its default constructor. However the reflective identification in R8 (wrongly) did not keep the class, causing the class to be treated as never instantiated (that is always null
).
We have fixed the reflective identification, and this has been merged to R8 8.7.28. You can use this together with AGP 8.7.3 and then you don't need the additional keep rules. See
Thank you for the report and the simple reproduction.
an...@google.com <an...@google.com> #13
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Ladybug Feature Drop | 2024.2.2 Patch 1
- Android Gradle Plugin 8.8.1
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
Description
I updated AGP to 8.7.3 (uses R8 8.7.18) and observed one screen began to crash with
NullPointerException
when it called Coroutinejob?.cancel
method.I downgraded back to AGP 8.6.1 (uses R8 8.6.27) which no longer crashes.
I have made a sample project that replicates the code and crash.
Steps to reproduce
alpha
. This creates an obfuscated build.Launch countdown Activity
debug
. This is not obfuscated . Try the above steps and observe it works.If you downgrade the versions and build
alpha
it does not crash.Note my real project and sample project both have
android.enableR8.fullMode=false
ingradle.properties
.