Native support for java 8 Lambdas on Android

A few months ago I wrote a tutorial about a simple way to incorporate java8 lambda features on Android (which only supports java 6/7 for now).

Well guess what? Android Nougat introduces support for Java 8 language features that you can use when developing apps that target Android version 24 from minSdkVersion 9 and up. We don’t need retrolambda no more :)

Here’s how to enable this feature on your build.gradle:

You can now start writing shorter code…


So things like this:

Become this:

Method References

Sometimes a lambda expression does nothing but call an existing method. In those cases, it’s often clearer to refer to the existing method by name. Method references are compact, easy-to-read lambda expressions for methods that already have a name:

Can be called as a method reference:

Known issues

Currently there is no support for Instant run nor data binding.

Because Jack does not generate intermediate class files when compiling an app, tools that depend on these files do not currently work with Jack. Some examples of these tools are:

  • Lint detectors that operate on class files;
  • Tools and libraries that require the app’s class files (such as instrumentation tests with JaCoCo).

I’ll personally not ditch retrolambda until instant run is supported but as soon as it is I’ll jump into the bandwagon :)

Hit me with a Tweet if you have any questions

Senior Android Developer, currently working as a Tech Lead @GlueHome. More on me @

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