Dagger类的生成
来源:2-13 RxLifecycle配置及使用
悠闲生活
2018-09-09
我使用Dagger2,其中AppComponent和ActivityComponent都能生成相应的Dagger类,但是UserComponent怎么也生不成Dagger类。重新编译了无数次,清除重写,还是不行。为什么呢
@Component(modules = [UserModule::class])
interface RegisterComponent {
fun inject(activity: RegisterActivity)
}
经过不断测试发现,只能在BaseLibrary这个module中才能生成Daggercomponent 类,在其他的module中不行,是不配置的问题呢,因为对Dagger所有的依赖文件都在BaseLibrary的build.gradle中
写回答
1回答
-
没有添加apt "xxxx.dagger"吧。注解处理器是每个模块都需要添加的,才能查找相应的注解,生成代码。
012018-09-11
相似问题