google / dagger

A fast dependency injector for Android and Java.
https://dagger.dev
Apache License 2.0
17.41k stars 2.01k forks source link

[Hilt] Gradle flavor. Cannot find symbol variable Module_ProvideFactory.providerFunction #3167

Closed AagitoEx closed 2 years ago

AagitoEx commented 2 years ago

I tried to add hilt to my existing android java project with flavors. I initial ran into failed gradle builds "could not resolve dependency" issue with hilt v2.38.1 now using hilt v2.40.5 gives this issue.

DaggerApp_HiltComponents_SingletonC.java
cannot find symbol variable AppModule_ProvideHttpClientFactory
cannot find symbol variable AppModule_ProvideLoggingInterceptorFactory
cannot find symbol variable AppModule_ProvideApiServiceFactory
cannot find symbol variable AppModule_ProvidePreferencesFactory
cannot find symbol variable AppModule_ProvideRetrofitFactory
where T is a type-variable:
T extends Object declared in class SwitchingProvider
cannot find symbol variable AppModule_ProvideGsonFactory
where T is a type-variable:
T extends Object declared in class SwitchingProvider

Could not find any resources online to solve this issue. Tried cleaning and deleting generated files, turning off incremental builds

AagitoEx commented 2 years ago

Weird behavior i observed today, i rewrote hilt module from kotlin to Java and it works. Didn't change anything else just java equivalent hilt module from kotlin. Is this something to do with kapt or hilt compiler?

Chang-Eric commented 2 years ago

Hm, I don't think we have seen this kind of issue before. Are you able to make a reproducible case for us to debug?

bcorso commented 2 years ago

Closing this for now, but feel free to reopen if you are still having this issue and have more information you can provide.