如何在Android Studio 3.1.4中使用数据绑定和Kotlin?

时间:2018-10-30 13:14:38

标签: gradle kotlin kapt

我收到错误消息,可能是Kotlin kapt 3rd-party Gradle插件造成的。我已经为kotlin-kapt添加了插件,并使用android.databindingV3 = true更新了gradle属性,但是我仍然收到错误的第三部分Gradle插件。 该如何解决?

apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android-extensions'
    apply plugin: 'kotlin-platform-android'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-kapt'


    android {
       ...
        dataBinding {
            enabled = true
        }

    }

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        implementation 'com.android.support:appcompat-v7:28.0.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        implementation 'com.android.support:recyclerview-v7:28.0.0'

        //Room
        implementation "android.arch.persistence.room:runtime:1.1.1"
        kapt "android.arch.persistence.room:compiler:1.1.1"

        ///Lifecycles, LiveData and ViewModel
        kapt 'com.android.databinding:compiler:3.1.4'

        // ViewModel and LiveData
        implementation "android.arch.lifecycle:extensions:1.1.1"

        // ViewModel
        implementation "android.arch.lifecycle:viewmodel:1.1.1"

        // LiveData
        implementation "android.arch.lifecycle:livedata:1.1.1"
        kapt "android.arch.lifecycle:compiler:1.1.1"

        annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
        androidTestImplementation "android.arch.persistence.room:testing:1.1.1"
        androidTestImplementation "android.arch.core:core-testing:1.1.1"
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    }

0 个答案:

没有答案