Dagger 2 component not generated

前端 未结 12 1563
走了就别回头了
走了就别回头了 2021-01-31 07:21

In my module, in my base Application class

component = DaggerCompClassComponent.builder()
                .classModule(new ModuleClass()).build();
12条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-31 08:22

    If Dagger2 can not generate its components it means that your code have some errors with Scopes/Modules. Check our your @Provides/Inject methods.

    UPD:

    You should inject your components into cases where you need instances of classes provided by module.

    like

    inject(MainActivity main);
    

提交回复
热议问题