使用两个组件 Dagger2 时的 stackoverflow
stackoverflow when using two components Dagger2
我有两个 Dagger 组件:
@GithubListActivityScope
@Component(modules = { GithubListActivityModule.class, GlideActivityModule.class })
public interface GithubListActivityComponent {
GithubUserListAdapter githubUserListAdapter ( );
//RequestManager requestManager();
LinearLayoutManager linearLayoutManager();
}
注:我试过评论和取消评论 RequestManager requestManager();
在GithubListActivityComponent
我还有一个这样的组件:
@Component(modules = { GithubApiServiceModule.class, GlideModule.class })
public interface GithubAppListComponent {
RequestManager getGlideRequestManager ( );
GithubAPIService getGitHubApiService ( );
}
问题: -> 当我删除的class文件时GithubListActivityComponent
或 delete/comment @Component Annotation 应用程序运行正常 BUT 当我尝试构建而不删除或评论 @组件注释文件出现以下错误:
Error:(7, 66) error: cannot find symbol class
DaggerGithubAppListComponent
Error:Execution failed for task
':app:compileDebugJavaWithJavac'.
java.lang.WhosebugError
P.S。 Oracle Jdk 版本 -> 1.8.0_121
移除循环依赖(A模块不应包含B模块if B 模块 包含 A )
我是如何解决我的问题的: GithubListActivityModule[= 上的提供者(@Provide 的方法) 26=] 并依赖 GlideActivityModule,我将它们移动到GlideActivityModule 删除依赖项。
我有两个 Dagger 组件:
@GithubListActivityScope
@Component(modules = { GithubListActivityModule.class, GlideActivityModule.class })
public interface GithubListActivityComponent {
GithubUserListAdapter githubUserListAdapter ( );
//RequestManager requestManager();
LinearLayoutManager linearLayoutManager();
}
注:我试过评论和取消评论 RequestManager requestManager();
在GithubListActivityComponent
我还有一个这样的组件:
@Component(modules = { GithubApiServiceModule.class, GlideModule.class })
public interface GithubAppListComponent {
RequestManager getGlideRequestManager ( );
GithubAPIService getGitHubApiService ( );
}
问题: -> 当我删除的class文件时GithubListActivityComponent
或 delete/comment @Component Annotation 应用程序运行正常 BUT 当我尝试构建而不删除或评论 @组件注释文件出现以下错误:
Error:(7, 66) error: cannot find symbol class DaggerGithubAppListComponent
Error:Execution failed for task ':app:compileDebugJavaWithJavac'. java.lang.WhosebugError
P.S。 Oracle Jdk 版本 -> 1.8.0_121
移除循环依赖(A模块不应包含B模块if B 模块 包含 A )
我是如何解决我的问题的: GithubListActivityModule[= 上的提供者(@Provide 的方法) 26=] 并依赖 GlideActivityModule,我将它们移动到GlideActivityModule 删除依赖项。