3

I make a project using dagger hilt and when I make a dynamic feature it shows an error like this

    /MyApplication_HiltComponents.java:166: error: [Dagger/MissingBinding] com.apps.jobwishlist3.core.domain.usecase.JobUseCase cannot be provided without an @Provides-annotated method.
  public abstract static class ApplicationC implements MyApplication_GeneratedInjector,
                         ^
  A binding with matching key exists in component: com.apps.jobwishlist3.MyApplication_HiltComponents.ActivityC
      com.apps.jobwishlist3.core.domain.usecase.JobUseCase is requested at
          com.apps.jobwishlist3.di.FullTimeModuleDependencies.jobUseCase()

I don't really know what the error means. I tried to erased @singeton and still, that error comes.

I already make everything it need for dagger hilt like this code

    @EntryPoint
@InstallIn(ApplicationComponent::class)
interface FullTimeModuleDependencies {

    fun jobUseCase(): JobUseCase
}

and this

    @Component(dependencies = [FullTimeModuleDependencies::class])
interface FullTimeComponent {

    fun inject(activity: FullTimeActivity)

    @Component.Builder
    interface Builder {
        fun context(@BindsInstance context: Context): Builder
        fun appDependencies(fullTimeModuleDependencies: FullTimeModuleDependencies): Builder
        fun build(): FullTimeComponent
    }

}

but still dagger doesn't generate it in my this activity code

DaggerFullTimeComponent.builder()
        .context(this)
        .appDependencies(
            EntryPointAccessors.fromApplication(
                applicationContext,
                FullTimeModuleDependencies::class.java
            )
        )
        .build()
        .inject(this)

the DaggerFullTimeComponent still red and I don't know what to do. please help if there someone know. Thank you.

this is my full project if you need to know the whole thing: https://github.com/cube76/JobWishlist3

Qube
  • 543
  • 3
  • 9
  • 23

1 Answers1

0

From your project, JobUseCase is the interface and dagger does not know how to provide him. Probably you have to add the binds method for your implementation of the JobUseCase into any dagger module.

@Binds 
fun bindJobUseCase(interactor: JobInteractor): JobUseCase
Dmytro Ivanov
  • 1,260
  • 1
  • 8
  • 10