在dagger module annotation中声明subcomponent的用例是什么?例如:
@Module(subcomponents = ChildComponent.class)
public class ModuleB 我已经阅读了文档,但找不到任何用法示例。
Any {@link Subcomponent}- or {@code @ProductionSubcomponent}-annotated classes which should be
* children of the component in which this module is installed. A subcomponent may be listed in
* more than one module in a component.发布于 2019-01-17 21:53:31
您可以指定应该依赖于您的模块所属的组件的子组件类。
我有带有模块ModuleA和组件B的组件A。如果在ModuleA中指定subcomponents = B.class,则dagger将不会编译给
error: A doesn't have a @Subcomponent.Builder, which is required when used with @Module.subcomponents
@Module(subcomponents = {B.class})
^除非组件B是A的子组件。
https://stackoverflow.com/questions/54234408
复制相似问题