Android Studio 3.0 + DataBinding + Kotlin 配置

一、配置Project的build.gradle

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

二、配置app的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "**************************"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0.17.09041"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    ......
    dataBinding {
        enabled = true
    }
}

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

kapt {
    generateStubs = true
}
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    kapt 'com.android.databinding:compiler:3.0.0'
    ......
}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 179,030評論 25 709
  • 文章摘要1、 c、c++項(xiàng)目的創(chuàng)建2、添加C、C++項(xiàng)目依賴庫4、配置Gradle,編譯lib so庫 英文文獻(xiàn) ...
    Android那些事兒閱讀 13,490評論 0 54
  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,554評論 19 139
  • Google引入Gradle和Android Studio時,希望更容易的去重用代碼、創(chuàng)建構(gòu)造變體和配置、自定義構(gòu)...
    sollian閱讀 3,462評論 0 10
  • 最后的眼淚 為什么成了最后的承諾 其實(shí)我的心,早在你離開的時候, 我己經(jīng)選擇沉默 為何你要用最后的虛偽 假裝的擔(dān)城...
    狂野的青春閱讀 289評論 0 0

友情鏈接更多精彩內(nèi)容