5

I'm testing Java 8+ API desugaring support on a project with minSdk 23.

When I use the java.time library, for example val instant = Instant.now(), I get the following error:

Call requires API level 26 (current min is 23): java.time.Instant#now

The code compiles and executes correctly.

Can I assume it will work for all devices?

EDIT: I've tried with API 29 (physical device) and API 23 (emulator).

kike
  • 4,255
  • 5
  • 23
  • 41
  • 1
    On which version of android you have tested ? as the warning says it will work only on 26 and above on below it will crash . – ADM Jul 10 '20 at 07:16
  • @ADM api levels 29 and 23. – kike Jul 10 '20 at 07:31
  • 2
    Well by looking at the docs it seems its independent of minimum API version with only gradle plugin 4.0.0 and above. If you use 4 and above then it should work . Also pls read the documentation carefully cause i see there is only a Sub set is available for some APIs.. And yeah i am not sure how this warning will go away .. – ADM Jul 10 '20 at 09:24

0 Answers0