I tried to replace Koin with Hilt (bad idea) for DI and now I'm stuck with this error: Hilt_App.java:21: error: cannot find symbol return DaggerApp_HiltComponents_ApplicationC.builder() ^ symbol: variable DaggerApp_HiltComponents_ApplicationC
What is it? How to fix it?
I got the same error message. My problem was that I had an old/deprecated gradle dependency. Make sure to remove following dpenedency from your gradle file:
/* DELETE this dependency */
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
If you are working on a modular project, take care of dependencies!
For example, if you have a retrofit
dependency in your data
module, even your data
module implemented
in the app
module, you must add retrofit
dependency as well or make them transactive with the api
to be accessible to the app
module.
For those who had the same error but did not miss any dependencies. I had this problem, because I forgot to annotate one class with "@Inject constructor". After I did that, everything worked again.
as answered in the guestion comments. The problem was that when using Jetpack integrations as explained here for the ViewModels https://developer.android.com/training/dependency-injection/hilt-jetpack and you have to add those dependencies also in the main app module (not only in the modules where you actually use ViewModels).
for example , if you have the following in the feature module's build.gradle file:
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hilt_lifecycle"
kapt "androidx.hilt:hilt-compiler:1.0.0-alpha02"
make sure you add them to the app's build.gradle file as well
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