Java 11+ APIs available through desugaring (original) (raw)

Skip to main content

Java 11+ APIs available through desugaring

Android Studio includes support for using a number of Java 11+ APIs without requiring a minimum API level for your app. This means that if you use an API introduced in Android 13 (API level 33) the code also works on all previous versions. Most APIs introduced to Android over the years are supported on Android 13. Through a process calledAPI desugaring, the DEX compiler (D8) allows you to include more standard language APIs in apps that support older versions of Android.

Java 11 support API desugaring comes in three flavors:

The following searchable table shows which Java 11+ libraries are available when you use the latest version of the Android Gradle plugin with thecoreLibraryDesugaring dependency set tocom.android.tools:desugar_jdk_libs:2.0.1 (seeAPI desugaringfor more information). Set this property in the build.gradle orbuild.gradle.kts file.

Package +
Class,
Enum,
or Interface

Constructors,
Properties,
and Methods

Notes

_java.io_
` BufferedReader

`

Additional methods on existing class.

_java.io_
` UncheckedIOException

`

Fully implemented class.

_java.lang_
` Iterable

`

Additional methods on existing class.

_java.time_
See customizations<br`

Clock

</br`

2 Not present in Android T (May not resolve at compilation).

_java.time_
See customizations<br`

DateTimeException

</br`

Fully implemented class.

_java.time_
See customizations<br`

DayOfWeek

</br`

Fully implemented class.

_java.time_
See customizations<br`

Duration

</br`

Fully implemented class.

_java.time_
See customizations<br`

Instant

</br`

Fully implemented class.

_java.time_
See customizations<br`

LocalDate

</br`

2 Not present in Android T (May not resolve at compilation).
3 Not supported at all minSDK levels.
4 Also supported with covariant return type.

_java.time_
See customizations<br`

LocalDateTime

</br`

Fully implemented class.

_java.time_
See customizations<br`

LocalTime

</br`

Fully implemented class.

_java.time_
See customizations<br`

Month

</br`

Fully implemented class.

_java.time_
See customizations<br`

MonthDay

</br`

Fully implemented class.

_java.time_
See customizations<br`

OffsetDateTime

</br`

Fully implemented class.

_java.time_
See customizations<br`

OffsetTime

</br`

2 Not present in Android T (May not resolve at compilation).

_java.time_
See customizations<br`

Period

</br`

Fully implemented class.

_java.time_
See customizations<br`

Year

</br`

Fully implemented class.

_java.time_
See customizations<br`

YearMonth

</br`

Fully implemented class.

_java.time_
See customizations<br`

ZoneId

</br`

Fully implemented class.

_java.time_
See customizations<br`

ZoneOffset

</br`

Fully implemented class.

_java.time_
See customizations<br`

ZonedDateTime

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

AbstractChronology

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

ChronoLocalDate

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

ChronoLocalDateTime

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

ChronoPeriod

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

ChronoZonedDateTime

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

Chronology

</br`

2 Not present in Android T (May not resolve at compilation).
3 Not supported at all minSDK levels.

_java.time.chrono_
See customizations<br`

Era

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

HijrahChronology

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

HijrahDate

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

HijrahEra

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

IsoChronology

</br`

2 Not present in Android T (May not resolve at compilation).
3 Not supported at all minSDK levels.

_java.time.chrono_
See customizations<br`

IsoEra

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

JapaneseChronology

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

JapaneseDate

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

JapaneseEra

</br`

Fully implemented class.
3 Not supported at all minSDK levels.

_java.time.chrono_
See customizations<br`

MinguoChronology

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

MinguoDate

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

MinguoEra

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

ThaiBuddhistChronology

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

ThaiBuddhistDate

</br`

Fully implemented class.

_java.time.chrono_
See customizations<br`

ThaiBuddhistEra

</br`

Fully implemented class.

_java.time.format_
See customizations<br`

DateTimeFormatter

</br`

Fully implemented class.

_java.time.format_
See customizations<br`

DateTimeFormatterBuilder

</br`

2 Not present in Android T (May not resolve at compilation).
3 Not supported at all minSDK levels.

_java.time.format_
See customizations<br`

DateTimeParseException

</br`

Fully implemented class.

_java.time.format_
See customizations<br`

DecimalStyle

</br`

Fully implemented class.

_java.time.format_
See customizations<br`

FormatStyle

</br`

Fully implemented class.

_java.time.format_
See customizations<br`

ResolverStyle

</br`

Fully implemented class.

_java.time.format_
See customizations<br`

SignStyle

</br`

Fully implemented class.

_java.time.format_
See customizations<br`

TextStyle

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

ChronoField

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

ChronoUnit

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

IsoFields

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

JulianFields

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

Temporal

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

TemporalAccessor

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

TemporalAdjuster

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

TemporalAdjusters

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

TemporalAmount

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

TemporalField

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

TemporalQueries

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

TemporalQuery

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

TemporalUnit

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

UnsupportedTemporalTypeException

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

ValueRange

</br`

Fully implemented class.

_java.time.temporal_
See customizations<br`

WeekFields

</br`

Fully implemented class.

_java.time.zone_
See customizations<br`

ZoneOffsetTransition

</br`

Fully implemented class.

_java.time.zone_
See customizations<br`

ZoneOffsetTransitionRule.
TimeDefinition

</br`

Fully implemented class.

_java.time.zone_
See customizations<br`

ZoneOffsetTransitionRule

</br`

Fully implemented class.

_java.time.zone_
See customizations<br`

ZoneRules

</br`

Fully implemented class.

_java.time.zone_
See customizations<br`

ZoneRulesException

</br`

Fully implemented class.

_java.util_
` Arrays

`

Additional methods on existing class.

_java.util_
` Calendar

`

Additional methods on existing class.

_java.util_
` Collection

`

Additional methods on existing class.
1 Supported only on devices which API level is 21 or higher.
3 Not supported at all minSDK levels.

_java.util_
` Collections

`

Additional methods on existing class.

_java.util_
` Comparator

`

Additional methods on existing class.

_java.util_
` Date

`

Additional methods on existing class.

_java.util_
` DoubleSummaryStatistics

`

2 Not present in Android T (May not resolve at compilation).
3 Not supported at all minSDK levels.

_java.util_
` GregorianCalendar

`

Additional methods on existing class.

_java.util_
` IntSummaryStatistics

`

3 Not supported at all minSDK levels.

_java.util_
` Iterator

`

Additional methods on existing class.

_java.util_
` List

`

Additional methods on existing class.

_java.util_
` LongSummaryStatistics

`

3 Not supported at all minSDK levels.

_java.util_
` Map.
Entry

`

Additional methods on existing class.

_java.util_
` Map

`

Additional methods on existing class.

_java.util_
` Objects

`

Fully implemented class.

_java.util_
` Optional

`

Fully implemented class.

_java.util_
` OptionalDouble

`

Fully implemented class.

_java.util_
` OptionalInt

`

Fully implemented class.

_java.util_
` OptionalLong

`

Fully implemented class.

_java.util_
` PrimitiveIterator.
OfDouble

`

Fully implemented class.

_java.util_
` PrimitiveIterator.
OfInt

`

Fully implemented class.

_java.util_
` PrimitiveIterator.
OfLong

`

Fully implemented class.

_java.util_
` PrimitiveIterator

`

Fully implemented class.

_java.util_
` Set

`

Additional methods on existing class.

_java.util_
` SortedSet

`

Additional methods on existing class.

_java.util_
` Spliterator.
OfDouble

`

Fully implemented class.

_java.util_
` Spliterator.
OfInt

`

Fully implemented class.

_java.util_
` Spliterator.
OfLong

`

Fully implemented class.

_java.util_
` Spliterator.
OfPrimitive

`

Fully implemented class.

_java.util_
` Spliterator

`

Fully implemented class.

_java.util_
` Spliterators.
AbstractDoubleSpliterator

`

Fully implemented class.

_java.util_
` Spliterators.
AbstractIntSpliterator

`

Fully implemented class.

_java.util_
` Spliterators.
AbstractLongSpliterator

`

Fully implemented class.

_java.util_
` Spliterators.
AbstractSpliterator

`

Fully implemented class.

_java.util_
` Spliterators

`

Fully implemented class.

_java.util_
` StringJoiner

`

Fully implemented class.

_java.util_
` TimeZone

`

Additional methods on existing class.

_java.util.concurrent_
` ConcurrentHashMap.
KeySetView

`

Some methods (8) present in Android T are not supported.

_java.util.concurrent_
` ConcurrentHashMap

`

Fully implemented class.

_java.util.concurrent_
` ConcurrentMap

`

Additional methods on existing class.

_java.util.concurrent_
` Flow.
Publisher

`

Fully implemented class.

_java.util.concurrent_
` Flow.
Subscriber

`

Fully implemented class.

_java.util.concurrent_
` Flow.
Subscription

`

Fully implemented class.

_java.util.concurrent_
` Flow

`

Fully implemented class.

_java.util.concurrent_
` ThreadLocalRandom

`

Fully implemented class.

_java.util.concurrent_
` TimeUnit

`

Additional methods on existing class.

_java.util._ _concurrent.atomic_
` AtomicInteger

`

Additional methods on existing class.

_java.util._ _concurrent.atomic_
` AtomicLong

`

Additional methods on existing class.

_java.util._ _concurrent.atomic_
` AtomicReference

`

Additional methods on existing class.

_java.util.function_
` BiConsumer

`

Fully implemented class.

_java.util.function_
` BiFunction

`

Fully implemented class.

_java.util.function_
` BiPredicate

`

Fully implemented class.

_java.util.function_
` BinaryOperator

`

Fully implemented class.

_java.util.function_
` BooleanSupplier

`

Fully implemented class.

_java.util.function_
` Consumer

`

Fully implemented class.

_java.util.function_
` DoubleBinaryOperator

`

Fully implemented class.

_java.util.function_
` DoubleConsumer

`

Fully implemented class.

_java.util.function_
` DoubleFunction

`

Fully implemented class.

_java.util.function_
` DoublePredicate

`

Fully implemented class.

_java.util.function_
` DoubleSupplier

`

Fully implemented class.

_java.util.function_
` DoubleToIntFunction

`

Fully implemented class.

_java.util.function_
` DoubleToLongFunction

`

Fully implemented class.

_java.util.function_
` DoubleUnaryOperator

`

Fully implemented class.

_java.util.function_
` Function

`

Fully implemented class.

_java.util.function_
` IntBinaryOperator

`

Fully implemented class.

_java.util.function_
` IntConsumer

`

Fully implemented class.

_java.util.function_
` IntFunction

`

Fully implemented class.

_java.util.function_
` IntPredicate

`

Fully implemented class.

_java.util.function_
` IntSupplier

`

Fully implemented class.

_java.util.function_
` IntToDoubleFunction

`

Fully implemented class.

_java.util.function_
` IntToLongFunction

`

Fully implemented class.

_java.util.function_
` IntUnaryOperator

`

Fully implemented class.

_java.util.function_
` LongBinaryOperator

`

Fully implemented class.

_java.util.function_
` LongConsumer

`

Fully implemented class.

_java.util.function_
` LongFunction

`

Fully implemented class.

_java.util.function_
` LongPredicate

`

Fully implemented class.

_java.util.function_
` LongSupplier

`

Fully implemented class.

_java.util.function_
` LongToDoubleFunction

`

Fully implemented class.

_java.util.function_
` LongToIntFunction

`

Fully implemented class.

_java.util.function_
` LongUnaryOperator

`

Fully implemented class.

_java.util.function_
` ObjDoubleConsumer

`

Fully implemented class.

_java.util.function_
` ObjIntConsumer

`

Fully implemented class.

_java.util.function_
` ObjLongConsumer

`

Fully implemented class.

_java.util.function_
` Predicate

`

Fully implemented class.

_java.util.function_
` Supplier

`

Fully implemented class.

_java.util.function_
` ToDoubleBiFunction

`

Fully implemented class.

_java.util.function_
` ToDoubleFunction

`

Fully implemented class.

_java.util.function_
` ToIntBiFunction

`

Fully implemented class.

_java.util.function_
` ToIntFunction

`

Fully implemented class.

_java.util.function_
` ToLongBiFunction

`

Fully implemented class.

_java.util.function_
` ToLongFunction

`

Fully implemented class.

_java.util.function_
` UnaryOperator

`

Fully implemented class.

_java.util.stream_
` BaseStream

`

1 Supported only on devices which API level is 21 or higher.

_java.util.stream_
` Collector.
Characteristics

`

Fully implemented class.

_java.util.stream_
` Collector

`

Fully implemented class.

_java.util.stream_
` Collectors

`

Fully implemented class.

_java.util.stream_
` DoubleStream.
Builder

`

Fully implemented class.

_java.util.stream_
` DoubleStream

`

1 Supported only on devices which API level is 21 or higher.
2 Not present in Android T (May not resolve at compilation).
3 Not supported at all minSDK levels.

_java.util.stream_
` IntStream.
Builder

`

Fully implemented class.

_java.util.stream_
` IntStream

`

1 Supported only on devices which API level is 21 or higher.
2 Not present in Android T (May not resolve at compilation).
3 Not supported at all minSDK levels.

_java.util.stream_
` LongStream.
Builder

`

Fully implemented class.

_java.util.stream_
` LongStream

`

1 Supported only on devices which API level is 21 or higher.
2 Not present in Android T (May not resolve at compilation).
3 Not supported at all minSDK levels.

_java.util.stream_
` Stream.
Builder

`

Fully implemented class.

_java.util.stream_
` Stream

`

2 Not present in Android T (May not resolve at compilation).
3 Not supported at all minSDK levels.

_java.util.stream_
` StreamSupport

`

Fully implemented class.

java.time customizations

The following is a summary of potentially behavior-changing modifications tojava.time that facilitate running the library on legacy Android devices.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2023-09-01 UTC.