android - 任何处理器都无法识别 Kapt 选项

标签 android gradle kotlin android-room gradle-kotlin-dsl

我不明白为什么 kotlin 注释处理器无法解析这些参数。

我的 build.gradle.kts 的相关部分

plugins {
    id("kotlin-kapt")
}

android {
    defaultConfig {
        kapt {
            arguments {
                arg("room.incremental", "true")
                arg("room.schemaLocation", "$projectDir/schemas")
            }
        }
    }
}

dependencies {
    implementation("androidx.room:room-runtime:${Versions.room_version}") // room_version = "2.2.4"
    kapt("androidx.room:room-compiler:${Versions.room_version}")
    implementation("androidx.room:room-ktx:${Versions.room_version}")
}


我得到的确切警告是
> Task :app:kaptDebugKotlin
warning: The following options were not recognized by any processor: '[room.schemaLocation, kapt.kotlin.generated, room.incremental]'
The following options were not recognized by any processor: '[room.schemaLocation, kapt.kotlin.generated, room.incremental]'

最佳答案

如果您的代码没有使用您的任何 Annotation processor's注释,则 kapt 任务将被跳过并且不会调用注释处理器因此,您传递的选项将被忽略,因为没有 调用 注释处理器(如果有的话)对它们感兴趣。

关于android - 任何处理器都无法识别 Kapt 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60689670/

相关文章:

Java/安卓 : Define object with unknown type

android - 在 android Textview 中显示样式和 ul li 标签

android - 如何通过我的应用程序识别具有我自己扩展名的压缩文件

java - android新手-这个背景会被调用多少次

android - 尝试更新到 Kotlin 1.4.0 时出现奇怪的错误。如何使其与 Gradle 和 IntelliJ IDEA 2020.2.1 一起使用?

android-studio - Android studio 使用 gradle2.5 依赖 com.android.tools.build :gradle-experimental:0. 2.1

java - Android Studio 3.0 未解决引用 : SupportedLanguages for AIConfiguration class in Dialogflow(api. ai)

flutter - 收到此错误 : java.net.BindException:地址已在使用中:无法绑定(bind)

kotlin - 可空成员的延迟初始化

android - 使用相机时如何打开/关闭手电筒?