Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find symbol return DaggerApplication_HiltComponents_SingletonC.builder()

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'

enter image description here Thank you all

like image 572
Stevie Avatar asked Dec 14 '22 07:12

Stevie


1 Answers

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

like image 68
Narek Hayrapetyan Avatar answered Jan 18 '23 08:01

Narek Hayrapetyan