Retrofit+RxJava(1)-在Android Studio中配置
在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
    }
}
//编译RxJava
compile 'io.reactivex:rxjava:1.0.14' 
//编译RxAndroid
compile 'io.reactivex:rxandroid:1.0.1'
//编译Retrofit及其相关库,包括Gson
compile '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路径  
 
                    
                     
                    
                 
                    
                 
         
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号