我有一个BaseActivity,里面有Dagger行为:
[shankai@shankai ~]$ pip3 install tensorflow
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
现在我要测试,是否正在调用applyDebugOverlay(this)。为此,我在AbstractActivityTest中使用Robolectric
abstract class BaseActivity : DaggerAppCompatActivity(), HasSupportFragmentInjector {
@Inject
lateinit var fragmentDispatchingAndroidInjector: DispatchingAndroidInjector<Fragment>
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
AndroidInjection.inject(this)
super.onCreate(savedInstanceState, persistentState)
/**
* Method that gets called after the [onCreate] method
*/
public override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)
applyDebugOverlay(this)
}
override fun supportFragmentInjector() = fragmentDispatchingAndroidInjector
}
但是我收到“没有为类绑定任何注入器工厂”错误,并且无法在我的ActivityBuilder类中将BaseActivity与@ContributesAndroidInjector绑定(会出现另一个错误)。