AndroidStudio3.0使用kotlin+ViewDataBinding

main-build.gradle

buildscript {
    ext.kotlin_version = '1.2.30'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

app-build.gradle

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

kapt {
    generateStubs = true
}

dependencies {
//version 需要与build:gradle相同
    kapt  "com.android.databinding:compiler:3.1.1"
}
在本地local.properites添加
kotlin.incremental=false

你可能感兴趣的:(AndroidStudio3.0使用kotlin+ViewDataBinding)