我不明白为什么 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/