:app:kaptDebugKotlin
w: warning: The following options were not recognized by any processor: '[kapt.kotlin.generated, room.incremental]'

Why am I getting this? I am using Room in a multi module project.

  • Kotlin版本:1.3.50
  • AGP: 3.5.0
  • Room: 2.2.0-rc01

共享库模块: api "androidx.room:room-runtime:$room_version" api "androidx.room:room-ktx:$room_version" api "androidx.room:room-rxjava2:$room_version"

应用程序模块:

kapt "androidx.room:room-compiler:$room_version"

格雷德尔.属性

kapt.incremental.apt=true

Build.gradle defaultConfig includes these compile options:

javaCompileOptions {
        annotationProcessorOptions {
            arguments = ["room.incremental":"true"]
        }
    }

推荐答案

这种类型的问题可能发生在已添加到文件室的多模块项目中.对于这样的项目,问题是由于将RoomDatabase派生类添加到库模块中,但配置了构建.应用程序模块的渐变.

解决方案是配置包含RoomDatabase派生类的模块的build.gradle.

  • In the build.gradle file in the dependencies{} section add the dependency for the room compiler.
kapt "android.arch.persistence.room:compiler:$room_version"

请注意,对于基于java的项目,请使用以下代码

annotationProcessor "android.arch.persistence.room:compiler:$room_version"

Kotlin相关问答推荐

当通过firstOrders访问时,存储在伴随对象中的对象列表具有空值

等待下一个值时暂停Kotlin Coroutine

Kotlin和JavaFX:绑定行为奇怪

为什么Kotlin函数参数名会 destruct 方法调用?

Kotlin:将泛型添加到列表任何>

Kotlin 中命名构造函数的惯用方式

Kotlin中反射中Int到可空Double的隐式转换失败

在 kotlin 中使具体化字段可选

如何在 Spring Boot 3 中为内部类提供运行时提示

将 Integer 转换为 Unit 编译成功

如何使用子变量在 Kotlin 中初始化父级

使用纯 Kotlin 函数作为 Junit5 方法源

从代码块执行和返回(在 Elvis 运算符之后)

Kotlin的web-framework框架

如何序列化/反序列化Kotlin密封类?

Jetpack Compose 折叠工具栏

Android studio 4.0 新更新版本说 Kotlin 与这个新版本不兼容

用 kotlin 学习 Android MVVM 架构组件

在 IntelliJ Idea 中未为 Kotlin @ConfigurationProperties 类生成 spring-configuration-metadata.json 文件

Kotlin中对象和数据类的区别是什么?