After upgrading to gradle 8, dagger doesn't work properly

35 views Asked by At

I have updated my gradle to version 8.2 and the plugin to 8.2.2 and after migrating the AndroidManifest packages to the namespace, I have added these two parameters to the gradle.properties:

android.nonTransitiveRClass=false
android.defaults.buildfeatures.buildconfig=true

The dagger injection has stopped working well in some of my classes, in particular in those that are not activity/fragment and I perform the injection in this way:

(applicationContext as HasAndroidInjector).androidInjector().inject(this)

My AppComponent is as follows:

@Singleton
@Component(
    modules = [
        AndroidInjectionModule::class,
        AppModule::class,
        LauncherModule::class,
        LoginModule::class
    ]
)
interface AppComponent {

    @Component.Builder
    interface Builder {

        @BindsInstance
        fun application(application: App): Builder

        fun build(): AppComponent
    }

    fun inject(app: App)
}

And this is the error I get:

dagger.android.DispatchingAndroidInjector$InvalidInjectorBindingException: com.example.android.project.di.DaggerAppComponent.MessagingServiceSubcomponentFactory does not implement AndroidInjector.Factory<com.example.android.project.notifications.service.MessagingService>
0

There are 0 answers