Bincy Baby
Bincy Baby

Reputation: 4713

warning : The following options were not recognized by any processor: '[dagger.fastInit, kapt.kotlin.generated]'

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

Answers (5)

Accolade
Accolade

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

Dr. Sa.M.
Dr. Sa.M.

Reputation: 2513

Move the id "kotlin-kapt" to the bottom of plugins{} in build.gradle Module-level.

Update

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:

  1. Removing annotationProcessor entries might help [Reference Answer]. But not always: Reference Document
  2. Replace annotationProcessor with ksp. (Reference)

Upvotes: 165

Daniil Pavlenko
Daniil Pavlenko

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:

  • from dagger.hilt.android.qualifiers package (@ApplicationContext, etc)
  • from 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

thijsonline
thijsonline

Reputation: 1227

For me adding this to the build file (in the android block) fixed it:

hilt {
    enableAggregatingTask = true
}

reference: https://youtrack.jetbrains.com/issue/KT-46940/Kapt-reports-a-warning-The-following-options-were-not-recognized-by-any-processor...#focus=Comments-27-5211169.0-0

Upvotes: 20

blacktiago
blacktiago

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

Related Questions