0
votes

I try to use Dagger2 in Kotlin but getting this error

error: [Dagger/MissingBinding] [com.syouth.tsarz.base.BaseComponent.getNavigationManager()] android.support.v4.app.FragmentManager cannot be provided without an @Provides-annotated method.

I'm really confused because I've provided FragmentManager in my module:

@Module
class BaseModule {

    @Provides
    @BaseScope
    fun provideFragmentManager(activity: FragmentActivity): FragmentManager = activity.supportFragmentManager

}

Here is my component:

@Subcomponent(modules = [(BaseModule::class)])
@BaseScope
interface BaseComponent {

    fun getNavigationManager(): NavigationManager

    @Subcomponent.Builder
    interface Builder {

        @BindsInstance
        fun activity(activity: FragmentActivity): Builder

        fun build(): BaseComponent
    }
}

Navigation manager is injected by using an @Inject constructor and class in annotated with @BaseScope

So basically I just try to get a dependency through a component which should be perfectly ok. Where am I wrong?

1

1 Answers

0
votes

Was using wrong annotation in scopes definition.