Setup

The option we will be using is Retrolambda (https://github.com/orfjackal/retrolambda). We will enable it by using a plugin for Android (https://github.com/evant/gradle-retrolambda).

Don't forget that, before using Java 8 features, you have to have the Oracle JDK 8 downloaded and running.

It can be done by simply adding the following at the very top of the application's app/build.gradle file:

plugins {
id "me.tatarka.retrolambda" version "3.4.0"
}

apply plugin: 'com.android.application'

Also, let's not forget to tell the IDE that we will be using Java 8 by adding the following block:

android {
...
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}

Finally, if proguard is being used, adding a line---dontwarn java.lang.invoke.*--to your proguard file might come in handy.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.107.193