: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.
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"]
}
}
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 KAPT used for? The answer to this is straight, it is used for annotation processing in Kotlin.
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.
app: Original kapt is deprecated.
While I agree that missing kapt in module was the original problem in IDE.
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).
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.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With