Native Java 8 arrives on android! Finally!

César Ferreira
May 16, 2017 · 1 min read

Starting with Android Studio 2.4 Preview 4 and android gradle plugin version 2.4.0-alpha4, Java 8 language features are now natively supported by android:

Also from min API level 24 the following Java 8 API are available:

  • java.util.stream
  • java.util.function
  • java.lang.FunctionalInterface
  • java.lang.annotation.Repeatable
  • java.lang.reflect.AnnotatedElement.getAnnotationsByType(Class)
  • java.lang.reflect.Method.isDefault()

The Android team promised that more Java 8 features are going to be added in the future.

How can I enable this then?

Add the following to your project’s main build.gradle:

Add these lines to your application module’s build.gradle to inform the project of the language level:


You’re done! You can now use native java8!


Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store