数据绑定注释处理器kapt警告

cre*_*n90 15 android annotation-processing kotlin kapt

在我的app模块的build.gradle中,我添加了

dependencies {
kapt('com.android.databinding:compiler:3.1.2')
...
}
Run Code Online (Sandbox Code Playgroud)

但我仍然收到编译器警告

app: 'annotationProcessor' dependencies won't be recognized as kapt annotation processors. Please change the configuration name to 'kapt' for these artifacts: 'com.android.databinding:compiler:3.1.2'.
Run Code Online (Sandbox Code Playgroud)

一切正常,我只是讨厌挂着警告.

任何帮助深表感谢!

ser*_*nka 14

在升级到最新的 Android Gradle 构建插件和 Kotlin 之前,我收到了相同的警告。现在他们走了。这是我使用的配置。

项目.gradle

buildscript {
    dependencies {
        classpath "com.android.tools.build:gradle:3.1.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.51"
    }
}
Run Code Online (Sandbox Code Playgroud)

模块.gradle

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
    ...
    dataBinding {
        enabled = true
    }
}

dependencies {
    // no kapt declaration for databinding here
}
Run Code Online (Sandbox Code Playgroud)

希望能帮助到你。