Kapt options are not recognized by any processor

Viewed 2743

I can't figure out why the kotlin annotation processor cannot resolve these arguments.

Relevant parts of my 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}")
}

The exact warning I get is

> 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]'
2 Answers

If your code does not use any of your Annotation processor's annotation then the kapt task will be skipped and no annotation processor will be invoked hence, options you passed will be ignored since no invoked annotation processor (if any) is interested in them.

Seems my problem was that I was trying to build the app right after setting up gradle, without actually implementing room annotations in the app. Once I did that, the warning went away.

I figure that the annotation processor does not get engaged at all till there are relevant annotations.

Related