数据绑定注释处理器Kapt警告 [英] Databinding annotation processor kapt warning

查看:851
本文介绍了数据绑定注释处理器Kapt警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序模块的build.gradle中,添加了

In my app module's build.gradle, I have added

dependencies {
kapt('com.android.databinding:compiler:3.1.2')
...
}

但是我仍然收到

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'.

所有功能,我只是讨厌周围有警告.

Everything functions, I just hate having warnings hanging around.

非常感谢您的帮助!

推荐答案

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

I had same warnings until I upgraded to the latest Android Gradle build plugin and Kotlin. Now they are gone. Here is the configuration I use.

project.gradle

buildscript {
    dependencies {
        classpath "com.android.tools.build:gradle:3.1.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.51"
    }
}

module.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
}

希望有帮助.

这篇关于数据绑定注释处理器Kapt警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆