android - 数据绑定(bind)注释处理器 kapt 警告

标签 android kotlin annotation-processing kapt

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

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

一切正常,我只是讨厌到处出现警告。

非常感谢任何帮助!

最佳答案

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

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
}

希望对你有帮助。

关于android - 数据绑定(bind)注释处理器 kapt 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50137564/

相关文章:

android - 在 Xamarin.forms 中创建一个页面作为 LoadingIndicator?

java - 从 JSONObject 中获取字符串

kotlin - Koin 中 Dagger 的 @Named 是什么?

java - 动态加载spring xml配置

gradle - Eclipse 上工厂路径中使用 gradle Nothing 进行注释处理

Android: Gingerbread 上的 YouTubePlayerFragment 出现 NoClassDefFoundError

android - 未使用协同程序获取Recyclerview数据

java - 如何通过注解处理工具获取extends接口(interface)?

java - 在注释处理期间如何从方法获取其参数的注释?

android - 自定义适配器的上下文参数 - getApplicationContext() 失败但 'this' 有效