首页 > 解决方案 > 如何在 Android 中启用对不可变对象的增量注释处理器支持

问题描述

我想知道在 Android 中为不可变库启用增量注释处理的正确程序是什么。该项目混合了 Java/Kotlin 代码并kapt用于注释处理。在关于这个线程的讨论之后,我在我的模块级build.gradle文件中尝试这个代码:

android {
    defaultConfig {
        kapt {
            arguments {
                arg("-Aimmutables.gradle.incremental", "true")
            }
        }
    }

dependencies {
    kapt "org.immutables:value:2.8.8"
    compileOnly "org.immutables:value:2.8.8”
    compileOnly "org.immutables:gson:2.8.8"
    }

但是当我构建我的项目时,我收到以下警告:

warning: The following options were not recognized by any processor: '[-Aimmutables.gradle.incremental, kapt.kotlin.generated]'

[WARN] Incremental annotation processing requested, but support is disabled because the following processors are not incremental: org.immutables.processor.ProxyProcessor (DYNAMIC).

我错过了什么吗?

标签: androidkotlingradlekaptimmutables-library

解决方案


推荐阅读