我使用匕首制作了一个项目,当我制作一个动态功能时,它会显示这样的错误
/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()
我真的不知道错误是什么意思。我试图删除@singeton,但仍然出现了那个错误。
我已经像这段代码一样制作了匕首柄所需的一切
@EntryPoint
@InstallIn(ApplicationComponent::class)
interface FullTimeModuleDependencies {
fun jobUseCase(): JobUseCase
}
和这个
@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
}
}
但匕首仍然没有在我的这个活动代码中生成它
DaggerFullTimeComponent.builder()
.context(this)
.appDependencies(
EntryPointAccessors.fromApplication(
applicationContext,
FullTimeModuleDependencies::class.java
)
)
.build()
.inject(this)
还是红色的DaggerFullTimeComponent
,我不知道该怎么办。如果有人知道,请帮忙。谢谢你。
如果您需要了解全部内容,这是我的完整项目:https ://github.com/cube76/JobWishlist3