Android studio3.0 使用Lambda表达式

Android studio 3.0中废弃了原来lambda表达式的引入方式,只需要在module的的build.gradle的中加入 

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

具体如下

android {
    compileSdkVersion 24
    buildToolsVersion "27.0.3"

    defaultConfig {
        minSdkVersion 15
        applicationId "com.foolstudio.VehicleNumDemo"

        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath = true
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
不得不说  Android studio 是越来越好用了





你可能感兴趣的:(开发随记)