dagger: Hilt: Compiler processor doesn't recognize options dagger.fastInit, dagger.hilt.android.internal.disableAndroidSuperclassValidation

Hello.

I am developing multi-module Android project with Hilt version 2.28.3-alpha. I have included dagger compiler to every module which requests or provides. After compilation in Android studio 4.0.1 I see warnings in every module:

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

Though these are warnings I was taught to pay attention to them as well, since they might indicate a potential problem with logic or performance, or anything else.

Applications seems to compile and run successfully, but are these warnings important? May be I am missing some Dagger Hilt setting?

Thank you.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 21
  • Comments: 15 (2 by maintainers)

Commits related to this issue

Most upvoted comments

I had same problem. added: id ‘com.google.dagger.hilt.android’ to build gradle and it works

Could it be that a module that reports this doesn’t use some of the Hilt features? Maybe the module that reports this doesn’t use any @AndroidEntryPoint ? Just guessing, I haven’t checked that assumption at all.

Thanks for the repro @jt-9!

Unfortunately, I don’t think there’s much we can do on our end about it. This appears to be a kapt issue (note: it doesn’t happen with annotationProcessor).

It seems kapt ignores Processor#getSupportedOptions() if none of the Processor#getSupportedAnnotationsTypes() are found in the sources.

In your case, component_db uses Dagger but not Hilt annotations in the sources, which is why the Dagger option dagger.fastInit doesn’t show up as unrecognized in that case. However, for base_ui you don’t use Dagger or Hilt annotations in the sources, which is why all of the options show up as unrecognized.

Solution

There’s a couple options here:

  1. File a bug against kapt to not ignore compiler options
  2. Remove the Dagger/Hilt processors from modules that don’t use Dagger/Hilt annotations
  3. Ignore the warnings

Hi @bcorso, sorry for late response. Here is reproducible example app https://github.com/jt-9/HiltMultiModuleMRP, if you build it with command ./gradlew clean assembleRelease output should be similar to

...
> Task :component_db:kaptDebugKotlin
warning: The following options were not recognized by any processor: '[dagger.hilt.android.internal.disableAndroidSuperclassValidation, kapt.kotlin.generated]'
...

As for other warning with '[dagger.fastInit, kapt.kotlin.generated]' still working on that.

@lukas1 Thanks for sharing an idea, will try it.

@jt-9 Did you ever end up filing an issue on the Kotlin issue tracker?

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

I’m going to close this since there doesn’t seem to be much we can do about this warning from our side.

@bcorso I updated the repository with app that reproduces warnings https://github.com/jt-9/HiltMultiModuleMRP

Thanks to @lukas1 point I added module base_ui which contains BaseViewModelActivity but doesn’t use any Dagger Hilt feature, but it still includes compiler as a part of common include config.gradle which results in warning

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

Hi @jt-9, I wasn’t able to reproduce this. Do you have a minimal reproducible example app that you could share that demonstrates the behavior?