Retrofit+RxJava实战日志(1)-在Android Studio中配置

来源:互联网 发布:算法设计与分析陈慧南 编辑:程序博客网 时间:2024/05/13 06:08

在build.gradle中添加

//加入retrolambda需要的plugin声明apply plugin: 'me.tatarka.retrolambda'        //retrolambda的编译路径依赖 buildscript {    dependencies {         classpath 'me.tatarka:gradle-retrolambda:3.1.0'    }}//让IDE使用用Java8语法解析android {    compileOptions {        sourceCompatibility JavaVersion.VERSION_1_8        targetCompatibility JavaVersion.VERSION_1_8    }}//编译RxJavacompile 'io.reactivex:rxjava:1.0.14' //编译RxAndroidcompile 'io.reactivex:rxandroid:1.0.1'//编译Retrofit及其相关库,包括Gsoncompile 'com.squareup.retrofit:retrofit:2.0.0-beta2'compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'compile 'com.google.code.gson:gson:2.4'

Retrolambda是借用Java8的语法特性,需要配置好Java8
安装好Java8后在File > Project structure > SDK Location中配置Java8路径

2 0
原创粉丝点击