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
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • jHipster - 微服务搭建 CC_简书[https://www.jianshu.com/u/be0d56c4...
    quanjj阅读 846评论 0 2
  • Android Studio正式版早已经发布了,默认使用Gradle构建,GitHub上80%的Android项目...
    流哲羽阅读 2,912评论 1 13
  • 说明 本文主要介绍和Gradle关系密切、相对不容易理解的配置,偏重概念介绍。部分内容是Android特有的(例如...
    jzj1993阅读 15,770评论 1 62
  • 前几天去医院看病,见到医院门口围了好多人。 我好奇的走上前瞧了瞧,问了旁边的人才知道,哪个打着横幅闹事的人是以...
    一杆红阅读 286评论 0 3
  • 曾经有那么一段时间,网络特别流行一句话: 我有故事,你有酒吗?每当听到这句话,我总是不由自主得想起我年少的时候,父...
    米娅丽雅阅读 509评论 3 15