1、项目build.gradle中添加如下:
dependencies {
classpath ‘com.android.tools.build:gradle:2.2.0’
// 添加lambda
classpath ‘me.tatarka:gradle-retrolambda:+’
}
2、module(app)的build.gradle中添加如下:
(1)apply plugin: ‘me.tatarka.retrolambda’
(2)
// 配置 支持 jdk8的lambda
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
(3)
dependencies {
compile ‘io.reactivex:rxjava:+’
compile ‘io.reactivex:rxandroid:+’
}