3

The context:

  • I Have two modules in my project: A and B
  • The module A depends on module B
  • The module B have a Dagger 2 dependency defined into my gradle file
  • The module A have components that use @modules classes from Module B to provide the intances to use with dependency injection

The problem: The Dagger 2 processor, responsible to code generation, doesn't create any classes necessaries to provide the dependencies defined on @module classes located on module B.

The doubts:

  • Is not possible to use Dagger 2 between modules?
  • Have another way to solve my problem?
pablobaldez
  • 924
  • 14
  • 22

1 Answers1

2

I found an way to do that. I have to create a subcomponent responsible to expose the @provide methods from my @module classes. So, my components from Module A have dependencies from subcomponents defined on Module B. Easy

pablobaldez
  • 924
  • 14
  • 22