Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

: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 version: 1.3.50
  • AGP: 3.5.0
  • Room: 2.2.0-rc01

Shared libraries module: api "androidx.room:room-runtime:$room_version" api "androidx.room:room-ktx:$room_version" api "androidx.room:room-rxjava2:$room_version"

App module:

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

Gradle.properties

kapt.incremental.apt=true

Build.gradle defaultConfig includes these compile options:

javaCompileOptions {
        annotationProcessorOptions {
            arguments = ["room.incremental":"true"]
        }
    }
like image 267
Daniel Wilson Avatar asked Oct 03 '19 09:10

Daniel Wilson


People also ask

How do I enable kotlin kapt?

Use the latest version of Kotlin annotation processor put this line at top of your module's level build. gradle file As the message says, all you have to do is you have to enable Kotlin plugin before kotlin-kapt in app\build. gradle . The plugin contents of app\build.

What is kotlin kapt used for?

What is KAPT used for? The answer to this is straight, it is used for annotation processing in Kotlin.

What is kotlin annotation processor?

KSP (Kotlin Symbol Processor) is a new API from Google for writing Kotlin compiler plugins. Using KSP we can write annotation processors to reduce boilerplate, solve cross-cutting concerns, and move checks from runtime to compile-time.

Is kapt deprecated?

app: Original kapt is deprecated.


2 Answers

While I agree that missing kapt in module was the original problem in IDE.

  • "androidx.room:room-compiler:${roomVersion}"

There can be other one in CLI, which you can see with verbose warnings:

Current JDK version 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12 has a bug (https://bugs.openjdk.java.net/browse/JDK-8007720) that prevents Room from being incremental. Consider using JDK 11+ or the embedded JDK shipped with Android Studio 3.5+.warning: The following options were not recognized by any processor: '[kapt.kotlin.generated, room.incremental]'[WARN] Incremental annotation processing requested, but support is disabled because the following processors are not incremental: androidx.room.RoomProcessor (DYNAMIC).

like image 79
Michal Reiter Avatar answered Sep 19 '22 16:09

Michal Reiter


This type of problem can occure with a multi-module project that has been added to room. For such a project the problem was caused by adding the RoomDatabase derived class to a library module, but configuring the build.gradle of app module.

The solution is to configure the build.gradle of the module that contains the RoomDatabase derived class.

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

Note that for java based project use below code

annotationProcessor "android.arch.persistence.room:compiler:$room_version"
like image 29
Kaushik Burkule Avatar answered Sep 21 '22 16:09

Kaushik Burkule