我很想知道为什么会收到此错误:Presenter cannot be provided without an @Provides-annotated method.
我什至尝试剥离所有内容并使之尽可能简单,但仍然出现错误。我在做什么错了?
组件:
@Component(modules = [SplashScreenModule::class])
interface SplashScreenComponent {
fun presenter() : SplashScreenContract.Presenter
}
模块:
@Module
abstract class SplashScreenModule {
@Binds
@SplashScreenScope
abstract fun providesSplashScreenPresenter(presenter: SplashScreenPresenter) : SplashScreenContract.Presenter
}
演示者:
class SplashScreenPresenter : SplashScreenContract.Presenter { ... }
答案 0 :(得分:0)
您需要@Inject批注
class SplashScreenPresenter @Inject constructor() : SplashScreenContract.Presenter { ... }
答案 1 :(得分:0)
对我来说这是一个愚蠢的错误。
我将SplashScreenScope
注释为@Qualifier
而不是@Scope