在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路径  

相关文章:

  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
  • 2022-01-12
  • 2021-07-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
  • 2021-11-18
  • 2022-01-11
  • 2022-01-23
  • 2021-07-23
相关资源
相似解决方案