Status Update
Comments
rk...@google.com <rk...@google.com>
tn...@google.com <tn...@google.com> #2
Can you give some more details on how to reproduce this? Which specific API is flagged for example?
I've attached a simple repro project; I have a java.time reference, and commented out core library desugaring; with that, lint correctly flags the problem:
$ ./gradlew :app:lint
...
DesugaringTest/app/src/main/java/com/example/desugaringtest/MainActivity.kt:13: Error: Call requires API level 26 (current min is 24): java.time.LocalTime#getHour [NewApi]
println(time.hour)
~~~~
1 errors, 0 warnings
When I uncomment the library desugaring statements at the bottom of app/build.gradle, lint stops complaining:
$ ./gradlew :app:lint
BUILD SUCCESSFUL in 1s
20 actionable tasks: 3 executed, 17 up-to-date
ey...@gmail.com <ey...@gmail.com> #3
Looks like the desugared code has to be in a separate module. I modified your project to repro and attached here.
tn...@google.com <tn...@google.com> #4
Thanks for the repro case! Investigating.
ma...@gmail.com <ma...@gmail.com> #5
I just bumped into this as well. To reproduce, you can use the reproducer-260755411
branch of the ./gradlew :shared:lintDebug
:
$ ./gradlew :shared:lintDebug
> Configure project :shared
> Task :shared:lintReportDebug
Wrote HTML report to file:///Users/mbonnin/git/Confetti/shared/build/reports/lint-results-debug.html
> Task :shared:lintDebug FAILED
Lint found 1 errors, 0 warnings. First failure:
/Users/mbonnin/git/Confetti/shared/src/androidMain/kotlin/dev/johnoreilly/confetti/utils/AndroidDateTimeFormatter.kt:15: Error: Cast from Instant to TemporalAccessor requires API level 26 (current min is 21) [NewApi]
return formatter.withZone(ZoneId.of(timeZone.id)).format(instant.toJavaInstant())
~~~~~~~~~~~~~~~~~~~~~~~
There was no error on AGP 7.3.1
tn...@google.com <tn...@google.com> #6
This bug is fixed by
There was also a related fix here for the scenario where you run lint on the library itself:
Thanks for the report and especially the clear repro!
tn...@google.com <tn...@google.com> #7
Actually it sounds from the initial report like this wasn't broken in 7.4 (
ma...@gmail.com <ma...@gmail.com> #8
Also I just tried 8.0.0-alpha10 and it seems to be fixed there as well 👍
tn...@google.com <tn...@google.com> #9
Thanks for confirming, glad to hear it!
Description
I just updated to Flamingo Alpha 8 from EE Beta 5 and running lint results in NewApi errors for
java.time.*
(272 occurrences in my app). My minApi is 24 and lint is saying that all of these calls require minApi 26. I have desugaring enabled.