按照老罗视频进行响应式开发的环境搭建:在项目的build.gradle中
1.导入相关的包:在dependencics中加入
compile 'io.reactivex:rxjava:1.1.0'
compile 'io.reactivex:rxandroid:1.1.0'
2.支持JDK1.8,(使用表达式语言):在android中加入
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
3.在开头添加一个使用表达式语言的插件:
apply plugin: 'me.tatarka.retrolambda'
4.在工程的gradle中添加classpath:
classpath 'me.tatarka:gradle-retrolambda:2.5.0'