I switched to Hilt dependency injection this morning. After everything is done, then I stuck with this one:
error: cannot find symbol return DaggerMyApplication_HiltComponents_SingletonC.builder() ^ symbol: variable DaggerMyApplication_HiltComponents_SingletonC
I did try to find the solution my self and I found this one, but I already added all module's build.gradle Please take a look at mine if I did anything wrong.
My application:
@HiltAndroidApp
class MyApplication : MultiDexApplication()
Project Gradle:
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.34-beta'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
App Gradle:
implementation 'com.google.dagger:hilt-android:2.34-beta'
kapt 'com.google.dagger:hilt-compiler:2.34-beta'
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
kapt 'androidx.hilt:hilt-compiler:1.0.0-beta01'
Thank you all
In my case this error caused by androidx.hilt:hilt-lifecycle-viewmodel
dependency
According to Dagger Hilt Github comments:
implementation "androidx.hilt:hilt-lifecycle-viewmodel"
kapt "androidx.hilt:hilt-compiler"
should be removed.
see this, also this
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