I am sorry to make you confuse. This is my fault.
In my case, put above code in ActivityModule
is working.
The MainFragment
is not ready in MainFragmentModule
.
@Module
abstract class MainActivityModule {
@FragmentScope
@ContributesAndroidInjector
abstract fun contributeMainFragment() : MainFragment
@Binds
@IntoMap
@FragmentKey(MainFragment::class)
abstract fun bindMainFragment(fragment: MainFragment): Fragment
}
bindMainFragment
in MainActivityModule
is working. but the Test is not working correctly I think.