Android Studio常用库


RxAndroid

build.gradle(app)中添加

dependencies {
    compile 'io.reactivex:rxandroid:1.1.0'
    compile 'io.reactivex:rxjava:1.1.0'
}

Butterknife

compile 'com.jakewharton:butterknife:7.0.1'

或者使用离线gradle:

libs下导入butterknife-7.0.1.jar build.gradle(app)中添加

dependencies {
    // 使用butterknife注解自动生成findViewById
    compile files('libs/butterknife-7.0.1.jar')
}

注:为了让代码更加简洁,推荐将注解和生成的view放在同一行,可以对setting做如下修改 Code Style->Java->Wrapping and Braces->Field Annotatios,设置为Do not wrap

Retrolambda

build.gradle(app)中添加

android {
    ...
    // 使用java 8,支持Lambda
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
...
// 使用retrolambda
buildscript {

    dependencies {
        classpath 'me.tatarka:gradle-retrolambda:3.2.4'
    }
}

apply plugin: 'me.tatarka.retrolambda'