Android 数据绑定:如何避免“找不到 KaptTask"警告 [英] Android Data Binding: How to avoid "cannot find the KaptTask" warning

查看:242
本文介绍了Android 数据绑定:如何避免“找不到 KaptTask"警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个库模块的大型 Android 项目.它们都使用 Kotlin,并且许多都启用了数据绑定.项目和所有模块构建和运行都很好,没有错误.

I have a large Android project with multiple library modules. They all use Kotlin, and many have data binding enabled. The project and all modules build and run just fine with no errors.

但是,我在每个模块的 Gradle 同步日志中收到一条警告,我认为这是误报:

However, I have been getting a warning in the Gradle sync logs for each module that I think is a false positive:

> Configure project :feature-a
Kotlin plugin is applied to the project :feature-a but we cannot find the KaptTask. Make sure you apply the kotlin-kapt plugin because it is necessary to use kotlin with data binding.

> Configure project :feature-b
Kotlin plugin is applied to the project :feature-b but we cannot find the KaptTask. Make sure you apply the kotlin-kapt plugin because it is necessary to use kotlin with data binding.

> Configure project :feature-c
Kotlin plugin is applied to the project :feature-c but we cannot find the KaptTask. Make sure you apply the kotlin-kapt plugin because it is necessary to use kotlin with data binding.

[... etc. for dozens of modules ...]

我已检查以确保正确应用了kotlin-kapt"插件.我正在为所有模块使用 Kotlin Gradle DSL,并且正在应用这样的插件:

I have checked to make sure that the "kotlin-kapt" plugin is properly applied. I'm using the Kotlin Gradle DSL for all modules and am applying the plugin like this:

plugins {
    id("com.android.library")
    id("kotlin-android")
    id("kotlin-android-extensions")
    id("kotlin-kapt")
    id("androidx.navigation.safeargs.kotlin")
}

是什么导致了这个警告,它实际上是一个问题,我该如何让它消失?

What is causing this warning, is it actually a problem, and how do I get it to disappear?

推荐答案

如果你的项目有buildSrc,可以删除build.gradle ->

if you project have buildSrc, you can delete build.gradle ->

implementation gradleApi()
implementation localGroovy()

replease remote url 

这篇关于Android 数据绑定:如何避免“找不到 KaptTask"警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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