今天使用dagger时遇到一个错误,提示完全不知所云
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| D:\Project\AS\Label\app\src\main\java\com\xxx\xxx\label\LabelApp.java:44: 错误: 找不到符号 import com.xxx.xxx.label.di.component.DaggerAppComponent; ^ 符号: 类 DaggerAppComponent 位置: 程序包 com.xxx.xxx.label.di.component D:\Project\AS\Label\app\src\main\java\com\xxx\xxx\label\di\component\AppComponent.java:36: 错误: [Dagger/MapKeys] [dagger.android.AndroidInjector.inject(T)] The same map key is bound more than once for java.util.Map<java.lang.Class<? extends androidx.fragment.app.Fragment>,javax.inject.Provider<dagger.android.AndroidInjector.Factory<? extends androidx.fragment.app.Fragment>>> public interface AppComponent { ^ @Binds @dagger.multibindings.IntoMap @dagger.android.support.FragmentKey(com.xxx.xxx.label.ui.fragment.menu.MenuFragment.class) dagger.android.AndroidInjector.Factory<? extends androidx.fragment.app.Fragment> com.xxx.xxx.label.ui.fragment.product.item.ItemInfoFragmentProvider_ProvideMenuFragmentFactory.bindAndroidInjectorFactory(com.xxx.xxx.label.ui.fragment.product.item.ItemInfoFragmentProvider_ProvideMenuFragmentFactory.MenuFragmentSubcomponent.Builder) @Binds @dagger.multibindings.IntoMap @dagger.android.support.FragmentKey(com.xxx.xxx.label.ui.fragment.menu.MenuFragment.class) dagger.android.AndroidInjector.Factory<? extends androidx.fragment.app.Fragment> com.xxx.xxx.label.ui.fragment.product.category.CategoryFragmentProvider_ProvideMenuFragmentFactory.bindAndroidInjectorFactory(com.xxx.xxx.label.ui.fragment.product.category.CategoryFragmentProvider_ProvideMenuFragmentFactory.MenuFragmentSubcomponent.Builder) java.util.Map<java.lang.Class<? extends androidx.fragment.app.Fragment>,javax.inject.Provider<dagger.android.AndroidInjector.Factory<? extends androidx.fragment.app.Fragment>>> is injected at dagger.android.DispatchingAndroidInjector.<init>(injectorFactories) dagger.android.DispatchingAndroidInjector<androidx.fragment.app.Fragment> is injected at com.xxx.xxx.label.ui.product.ProductActivity.fragmentDispatchingAndroidInjector com.xxx.xxx.label.ui.product.ProductActivity is injected at dagger.android.AndroidInjector.inject(T) component path: com.xxx.xxx.label.di.component.AppComponent → com.xxx.xxx.label.di.builder.ActivityBuilder_BindProductActivity.ProductActivitySubcomponent 2 个错误
|
解决方法
最后发现是一个公共对话框的provider没有导入