android studio使用lambda表达式,需要配置两点
1.项目的build.gradle中需要写入
dependencies { classpath 'me.tatarka:gradle-retrolambda:3.2.5' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }
2.在程序的app.gradle中加入:
apply plugin: 'me.tatarka.retrolambda'
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
3.sync now ok啦
使用 rxjava2 引入:
compile 'io.reactivex.rxjava2:rxandroid:2.0.1' compile 'io.reactivex.rxjava2:rxjava:2.0.1'