Status Update
Comments
cl...@google.com <cl...@google.com> #2
Stack trace retraced to:
Caused by: java.lang.NullPointerException: Cannot invoke "com.android.tools.r8.graph.E0.D1()" because the return value of "com.android.tools.r8.graph.y.d(com.android.tools.r8.graph.I2)" is null
at com.android.tools.r8.verticalclassmerging.policies.NoFieldResolutionChangesPolicy.fieldResolutionMayChange(NoFieldResolutionChangesPolicy.java:46)
at com.android.tools.r8.verticalclassmerging.policies.NoFieldResolutionChangesPolicy.canMerge(NoFieldResolutionChangesPolicy.java:30)
at com.android.tools.r8.verticalclassmerging.policies.VerticalClassMergerPolicy.canMerge(VerticalClassMergerPolicy.java:16)
at com.android.tools.r8.verticalclassmerging.policies.VerticalClassMergerPolicy.canMerge(VerticalClassMergerPolicy.java:9)
at com.android.tools.r8.verticalclassmerging.VerticalClassMergerPolicyExecutor.lambda$apply$1(VerticalClassMergerPolicyExecutor.java:75)
at com.android.tools.r8.verticalclassmerging.VerticalClassMergerPolicyExecutor.apply(VerticalClassMergerPolicyExecutor.java:73)
at com.android.tools.r8.verticalclassmerging.VerticalClassMergerPolicyExecutor.apply(VerticalClassMergerPolicyExecutor.java:66)
at com.android.tools.r8.classmerging.PolicyExecutor.run(PolicyExecutor.java:47)
at com.android.tools.r8.verticalclassmerging.VerticalClassMergerPolicyExecutor.run(VerticalClassMergerPolicyExecutor.java:44)
at com.android.tools.r8.verticalclassmerging.VerticalClassMerger.lambda$getConnectedComponentMergers$1(VerticalClassMerger.java:191)
at com.android.tools.r8.utils.ThreadUtils.lambda$processItemsWithResults$0(ThreadUtils.java:57)
at com.android.tools.r8.utils.ThreadUtils.lambda$processItemsWithResultsThatMatches$2(ThreadUtils.java:111)
Suppressed: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at com.android.tools.r8.utils.ExceptionUtils.unwrapExecutionException(ExceptionUtils.java:227)
at com.android.tools.r8.R8.run(R8.java:887)
at com.android.tools.r8.R8.run(R8.java:251)
at com.android.tools.r8.R8.lambda$runForTesting$1(R8.java:242)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:80)
at com.android.tools.r8.utils.ExceptionUtils.withR8CompilationHandler(ExceptionUtils.java:69)
at com.android.tools.r8.R8.runForTesting(R8.java:238)
at com.android.tools.r8.R8.run(R8.java:194)
at com.android.builder.dexing.R8Tool.runR8(r8Tool.kt:332)
at com.android.build.gradle.internal.tasks.R8Task$Companion.shrink(R8Task.kt:782)
at com.android.build.gradle.internal.tasks.R8Task$R8Runnable.execute(R8Task.kt:856)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)
...
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.base/java.util.concurrent.ForkJoinTask.reportExecutionException(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.get(Unknown Source)
at com.android.tools.r8.threading.providers.blocking.ThreadingModuleBlocking.awaitFutures(ThreadingModuleBlocking.java:40)
at com.android.tools.r8.threading.TaskCollection.await(TaskCollection.java:68)
at com.android.tools.r8.threading.TaskCollection.awaitWithResults(TaskCollection.java:139)
at com.android.tools.r8.threading.TaskCollection.awaitWithResults(TaskCollection.java:146)
at com.android.tools.r8.utils.ThreadUtils.processItemsWithResultsThatMatches(ThreadUtils.java:115)
at com.android.tools.r8.utils.ThreadUtils.processItemsWithResults(ThreadUtils.java:97)
at com.android.tools.r8.utils.ThreadUtils.processItemsWithResults(ThreadUtils.java:77)
at com.android.tools.r8.utils.ThreadUtils.processItemsWithResults(ThreadUtils.java:56)
at com.android.tools.r8.verticalclassmerging.VerticalClassMerger.getConnectedComponentMergers(VerticalClassMerger.java:185)
at com.android.tools.r8.verticalclassmerging.VerticalClassMerger.mergeClassesInConnectedComponents(VerticalClassMerger.java:167)
at com.android.tools.r8.verticalclassmerging.VerticalClassMerger.run(VerticalClassMerger.java:114)
at com.android.tools.r8.verticalclassmerging.VerticalClassMerger.runIfNecessary(VerticalClassMerger.java:83)
at com.android.tools.r8.R8.run(R8.java:745)
cl...@google.com <cl...@google.com> #3
This is the issue in R8:
private boolean fieldResolutionMayChange(DexClass source, DexClass target) {
if (source.getType().isIdenticalTo(target.getSuperType())) {
...
for (DexType interfaceType : target.getInterfaces()) {
DexClass clazz = appView.definitionFor(interfaceType);
46 > for (DexEncodedField staticField : clazz.staticFields()) {
...
Apparently your compilation has a class with a missing interface, and the code here in R8 does not support it. We should fix this, but I'm alone in the office for the next week so it will take some weeks to get fixed.
Do you use a proguard rule starting with "-dontwarn"? A work-around would be to identify the missing interface and add it to the input, or identify the problematic class here and keep it.
cl...@google.com <cl...@google.com> #4
fr...@paymentsense.com <fr...@paymentsense.com> #5
We do use -dontwarn with some package/classes. Do you want me to list here?
How could I find the missing interface?
sg...@google.com <sg...@google.com> #6
Finding the interface missing to this concrete code path is not easy with the current R8 options. This only method I can think of is to add the missing interfaces one by one (could probably be just empty interfaces to work around the issue) as see when the issue goes away. You can remove the -dontwarn
's to get the list of all missing classes and interfaces from the R8 error message.
ch...@google.com <ch...@google.com>
ap...@google.com <ap...@google.com> #7
Branch: main
commit 8e85555dd2b5809e22b88e8acbda4340154b4516
Author: Clément Béra <clementbera@google.com>
Date: Wed Jul 17 09:26:56 2024
Disable vertical class merging when missing itf are present
Bug:
Change-Id: Id79b930d66f4a3e0333f27caa1e7442838117d08
M src/main/java/com/android/tools/r8/verticalclassmerging/policies/NoFieldResolutionChangesPolicy.java
ap...@google.com <ap...@google.com> #8
Branch: 8.6
commit 3ec73ce1dbb45b2b43148cb32753ef1e9fada74d
Author: Clément Béra <clementbera@google.com>
Date: Tue Jul 30 13:07:49 2024
Version 8.6.16
Bug:
Bug:
Bug:
Bug:
Change-Id: I9f2ad5022503a910fad4e649cf5df8dbbb616316
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #9
Branch: 8.6
commit 640d49ed0f195afb12d58ffb3a8735403a2510e6
Author: Clément Béra <clementbera@google.com>
Date: Tue Jul 30 13:02:17 2024
Disable vertical class merging when missing itf are present
Bug:
Change-Id: Id79b930d66f4a3e0333f27caa1e7442838117d08
M src/main/java/com/android/tools/r8/verticalclassmerging/policies/NoFieldResolutionChangesPolicy.java
cl...@google.com <cl...@google.com>
ap...@google.com <ap...@google.com> #10
Branch: 8.5
commit d360da0f12e43c2e9798aaa1bdf3443cb7661e51
Author: Clément Béra <clementbera@google.com>
Date: Tue Jul 30 13:26:24 2024
Version 8.5.34
Bug:
Bug:
Bug:
Bug:
Change-Id: Ife8945c8f8ed416af360c78e5fc4267bba97b967
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #11
Branch: 8.5
commit 60fe447db214b03aa022ed5a0edea5f1bceb63ba
Author: Clément Béra <clementbera@google.com>
Date: Tue Jul 30 13:22:01 2024
Disable vertical class merging when missing itf are present
Bug:
Change-Id: Id79b930d66f4a3e0333f27caa1e7442838117d08
M src/main/java/com/android/tools/r8/verticalclassmerging/policies/NoFieldResolutionChangesPolicy.java
fr...@paymentsense.com <fr...@paymentsense.com> #12
I've tested with version 8.6.16 and now it's working correctly. Thanks
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 Koala Feature Drop | 2024.1.2 RC 1
- Android Gradle Plugin 8.6.0-rc01
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!
an...@google.com <an...@google.com> #14
The fixes for this issue are now also available in:
- Android Studio Koala | 2024.1.1 Patch 2
- Android Gradle Plugin 8.5.2
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
as...@gmail.com <as...@gmail.com> #15
انصØÙƒ بالتجربة
Description
After the upgrade to kotlin 2.0 I face this issue during the minifyReleaseWithR8 task:
NullPointerException: Cannot invoke "com.android.tools.r8.graph.E0.D1()" because the return value of "com.android.tools.r8.graph.y.d(com.android.tools.r8.graph.I2)" is null
I've found one way to solve the issue by setting/fixing the r8 version to 8.3.37. But if I use the one that comes embedded with AGP I face the issue. I'm not sure we want to block the r8 version, I think we would like to be able to use the embedded one. I've tried with other versions like 8.5.13 and I still get the issue.
I've tried running with --stacktrace but I couldn't see much more info, attached the stacktrace.
I've found another user with a really similar issue on stackoverflow posted recently:
(We have also a similar stack in terms of libs in the project)