Reputation: 4713
I get this warning when I try to run or build an app in Android Studio. Why am I getting this? Do I need to heed this warning?
The following options were not recognized by any processor: '[dagger.fastInit, kapt.kotlin.generated]'
Upvotes: 86
Views: 37555
Reputation: 1
Moving id "kotlin-kapt" or id("kotlin-kapt") to the bottom of plugins{} in the app/build.gradle will make it work fine
Upvotes: 0
Reputation: 2513
Move the id "kotlin-kapt"
to the bottom of plugins{}
in build.gradle
Module-level.
If you have migrated to KSP, as per the official documentation of dagger
Warning: Dagger’s KSP support is currently in alpha.
Here are a few steps that I believe might help:
annotationProcessor
entries might help [Reference Answer]. But not always: Reference DocumentannotationProcessor
with ksp
. (Reference)Upvotes: 165
Reputation: 573
For me solution was to remove kotlin-kapt
& dagger.hilt.android.plugin
from build.gradle
files in modules that use only below annotations:
dagger.hilt.android.qualifiers
package (@ApplicationContext
, etc)javax.inject
package (@Inject
, @Singleton
, etc)plugins {
alias(libs.plugins.com.android.library)
alias(libs.plugins.kotlin.android)
// ⬇️ remove these 2 plugins
id('dagger.hilt.android.plugin')
id('kotlin-kapt')
// ⬆️
}
dependencies {
// …
// leave it here to use @Inject or replace with javax.inject dependency
implementation "com.google.dagger:hilt-android"
// remove only this ⬇️
kapt "com.google.dagger:hilt-android-compiler"
}
Upvotes: 3
Reputation: 1227
For me adding this to the build file (in the android block) fixed it:
hilt {
enableAggregatingTask = true
}
Upvotes: 20
Reputation: 393
That happens when you compile a multi module project and some module has kapt but no entry point.
The issue is described here but is was already fixed here.
Just wait until next Android studio release or check if you have the latest versions of hilt and dagger
Upvotes: 16