Fixed
Status Update
Comments
rk...@google.com <rk...@google.com>
tn...@google.com <tn...@google.com> #2
This can be either an issue with interface method desugaring, most likely one of the dependency has now new static/default/private methods on interfaces which is incorrectly supported by our compiler, or it's an issue with desugared library, or both.
To rule the options out:
- Are you using desugared library in your project (https://developer.android.com/studio/write/java8-support-table )?
- What is the minSdk of your project? If it's strictly below 24, and you change it to 24, and let us know if the issue happens.
If you want us to help you further, for example by helping you build a work-around, or fix the compiler, we need you to either provide us a reproduction project (github or zip) or a compilation dump of your application (See how to generate dumps herehttps://r8.googlesource.com/r8/+/refs/heads/main/doc/compilerdump.md ).
Thanks for the report.
To rule the options out:
- Are you using desugared library in your project (
- What is the minSdk of your project? If it's strictly below 24, and you change it to 24, and let us know if the issue happens.
If you want us to help you further, for example by helping you build a work-around, or fix the compiler, we need you to either provide us a reproduction project (github or zip) or a compilation dump of your application (See how to generate dumps here
Thanks for the report.
an...@steadfastinnovation.com <an...@steadfastinnovation.com> #3
Yes, I'm using desugaring, version 1.2.2 (to work with LocalDate). I tried to build a signed apk with disabled desugaring and the build was successful.
In my project minSdk is 24.
Unfortunately I can't provide you the source code or dump as this is a confidential project, but I can provide a list of dependencies, build.gradle files and a class that works with LocalDate if that helps, or maybe smth else, but not a whole project(
In my project minSdk is 24.
Unfortunately I can't provide you the source code or dump as this is a confidential project, but I can provide a list of dependencies, build.gradle files and a class that works with LocalDate if that helps, or maybe smth else, but not a whole project(
tn...@google.com <tn...@google.com> #5
Retracing from Stack overflow gives:
Caused by: com.android.tools.r8.errors.Unreachable: Attempt to enqueue an action in a non pushable enqueuer work list.
at com.android.tools.r8.shaking.EnqueuerWorklist$NonPushableEnqueuerWorklist.attemptToEnqueue(EnqueuerWorklist.java:800)
at com.android.tools.r8.shaking.EnqueuerWorklist$NonPushableEnqueuerWorklist.enqueueMarkMethodLiveAction(EnqueuerWorklist.java:856)
at com.android.tools.r8.shaking.Enqueuer.markMethodAsLiveWithCompatRule(Enqueuer.java:4882)
at com.android.tools.r8.shaking.Enqueuer.markMethodAsTargeted(Enqueuer.java:4773)
at com.android.tools.r8.shaking.Enqueuer.lambda$markVirtualMethodAsReachable$88(Enqueuer.java:3387)
at com.android.tools.r8.graph.MethodResolutionResult$SingleProgramResolutionResult.visitMethodResolutionResults(MethodResolutionResult.java:897)
at com.android.tools.r8.graph.MethodResolutionResult.forEachMethodResolutionResult(MethodResolutionResult.java:103)
at com.android.tools.r8.shaking.Enqueuer.markVirtualMethodAsReachable(Enqueuer.java:3340)
at com.android.tools.r8.shaking.Enqueuer.traceInvokeInterface(Enqueuer.java:1463)
at com.android.tools.r8.shaking.Enqueuer.traceInvokeInterface(Enqueuer.java:1447)
at com.android.tools.r8.shaking.DefaultEnqueuerUseRegistry.registerInvokeInterface(DefaultEnqueuerUseRegistry.java:86)
at com.android.tools.r8.cf.code.CfInvoke.internalRegisterUse(CfInvoke.java:153)
at com.android.tools.r8.cf.code.CfInstruction.registerUse(CfInstruction.java:104)
at com.android.tools.r8.graph.CfCode.registerCodeReferences(CfCode.java:683)
at com.android.tools.r8.graph.ProgramMethod.registerCodeReferences(ProgramMethod.java:127)
at com.android.tools.r8.shaking.Enqueuer.traceCode(Enqueuer.java:4809)
at com.android.tools.r8.shaking.Enqueuer.traceNonDesugaredCode(Enqueuer.java:4803)
at com.android.tools.r8.shaking.Enqueuer.markMethodAsLive(Enqueuer.java:4742)
at com.android.tools.r8.shaking.EnqueuerWorklist$MarkMethodLiveAction.run(EnqueuerWorklist.java:166)
at com.android.tools.r8.shaking.Enqueuer.postProcessingDesugaring(Enqueuer.java:4540)
at com.android.tools.r8.shaking.Enqueuer.trace(Enqueuer.java:4477)
at com.android.tools.r8.shaking.Enqueuer.traceApplication(Enqueuer.java:3622)
at com.android.tools.r8.R8.runEnqueuer(R8.java:1012)
at com.android.tools.r8.R8.run(R8.java:369)
at com.android.tools.r8.R8.run(R8.java:252)
at com.android.tools.r8.R8.lambda$runForTesting$1(R8.java:243)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:80)
... 34 more
tn...@google.com <tn...@google.com> #6
This comes from the desugaring post processing. It could be:
- desugared library retargeting
interface method desugaring(not in 1.2 with 24)- api callback
record(not generating methods)disable desugarer(not generating method)
What's going on is that R8 is verifying that code generated in the post processor is targeting already traced code.
Is there in the app any override of the following 3 methods: [java.time.ZoneId java.util.TimeZone.toZoneId(), java.time.ZonedDateTime java.util.GregorianCalendar.toZonedDateTime(), java.time.Instant java.util.Date.toInstant()] ?
Alternatively, it could be that something not traced as a library override is now traced with the callback? @mkroghj wasn't there a change on library override computation and tracing?
an...@google.com <an...@google.com> #7
There are no overrides, however one of these methods is used (not overridden)
Here is how I use the method java.time.Instant java.util.Date.toInstant():
Date.from(value.atStartOfDay(ZoneId.systemDefault()).toInstant())
and in another place
value?.let { Date.from(it.atStartOfDay(ZoneId.systemDefault())?.toInstant()) } ?: Date()
both variable 'value' is the LocalDate
Here is how I use the method java.time.Instant java.util.Date.toInstant():
Date.from(value.atStartOfDay(ZoneId.systemDefault()).toInstant())
and in another place
value?.let { Date.from(it.atStartOfDay(ZoneId.systemDefault())?.toInstant()) } ?: Date()
both variable 'value' is the LocalDate
Description
java.nio
APIs can be used below API 26 withcoreLibraryDesugaring "com.android.tools:desugar_jdk_libs_nio:2.1.3"
. However, as described in thejava.nio
customizations documentationFor example, running the following on API 21 produces a
java.lang.UnsupportedOperationException
:This is expected per the documentation, but is not discoverable except at runtime.
However, when using
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.3"
(the non-nio artifact), usages of this API (and all otherjava.nio
APIs) produce lint errors unless wrapped in checks for API 26+.Is it possible to show lint errors just for the APIs that will fail at runtime when they're not wrapped in API checks for API 26+ when using
desugar_jdk_libs_nio
? That way the build will fail rather than discovering this at runtime.