我一直在关注来自谷歌的 GithubBrowserSample 作为我的参考。
我刚刚通过实施到我的 MainActivity 中对匕首进行了最后的润色,现在收到以下错误。除了包含我已经拥有的内容之外,似乎无法在其中找到太多内容。
error: [Dagger/MissingBinding] [dagger.android.AndroidInjector.inject(T)] java.util.Map<java.lang.String,javax.inject.Provider<dagger.android.AndroidInjector.Factory<? extends androidx.fragment.app.Fragment>>> cannot be provided without an @Provides-annotated method.
java.util.Map<java.lang.String,javax.inject.Provider<dagger.android.AndroidInjector.Factory<? extends androidx.fragment.app.Fragment>>> is injected at
dagger.android.DispatchingAndroidInjector.<init>(…, injectorFactoriesWithStringKeys)
dagger.android.DispatchingAndroidInjector<androidx.fragment.app.Fragment> is injected at
com.crosscare.MainActivity.dispatchingAndroidInjector
com.crosscare.MainActivity is injected at
dagger.android.AndroidInjector.inject(T)
component path: com.crosscare.di.AppComponent ? com.crosscare.di.MainActivityModule_ContributeMainActivity.MainActivitySubcomponent
主要活动:
public class MainActivity extends AppCompatActivity implements HasSupportFragmentInjector {
@Inject
DispatchingAndroidInjector<Fragment> dispatchingAndroidInjector;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public DispatchingAndroidInjector<Fragment> supportFragmentInjector() {
return dispatchingAndroidInjector;
}
}
应用组件:
@Singleton
@Component(modules = {
AndroidInjectionModule.class,
AppModule.class,
MainActivityModule.class
})
public interface AppComponent {
@Component.Builder
interface Builder {
@BindsInstance Builder application(Application application);
AppComponent build();
}
void inject(CrosscareApp crosscareApp);
}
任何建议将不胜感激。
哆啦的时光机
相关分类