简体   繁体   中英

stackoverflow when using two components Dagger2

I have two Components for Dagger :

@GithubListActivityScope
@Component(modules = { GithubListActivityModule.class, GlideActivityModule.class })
public interface GithubListActivityComponent {

GithubUserListAdapter githubUserListAdapter ( );
//RequestManager requestManager();
LinearLayoutManager linearLayoutManager();

}

Note : I have tried commenting and uncommenting RequestManager requestManager(); in GithubListActivityComponent

I have another Component like this :

@Component(modules = { GithubApiServiceModule.class, GlideModule.class })
public interface GithubAppListComponent {

RequestManager getGlideRequestManager ( );

GithubAPIService getGitHubApiService ( );
}

Problem : -> When I delete the class file of GithubListActivityComponent or delete/comment the @Component Annotation the app runs fine BUT when I try building without deleting or commenting the @Component Annotation the file I get the following error :

Error:(7, 66) error: cannot find symbol class DaggerGithubAppListComponent

Error:Execution failed for task ':app:compileDebugJavaWithJavac'. java.lang.StackOverflowError

PS Oracle Jdk version -> 1.8.0_121

Remove Circular Dependency ( A module should not include B Module if B Module includes A )

How I solved my problem : the providers(Methods with @Provide ) that were on GithubListActivityModule and depended on GlideActivityModule , I moved them into GlideActivityModule to remove the dependency.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM