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

Ris*_*hli 4 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}")
}

Run Code Online (Sandbox Code Playgroud)

我得到的确切警告是

> 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]'
Run Code Online (Sandbox Code Playgroud)

moh*_*ssa 6

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