title: How to Inject Dependencies "between" Android Modules with Dagger2 (2.15)
body: <p>My current Android project comprises of the following modules</p>
  
  <p>1). Main App</p>
  
  <p>2). Android Module A</p>
  
  <p>3). Android Module B</p>
  
  <p>4). Java Module C</p>
  
  <p>5). Android Module D</p>
  
  <p>I am using <code>Dagger 2 (v2.15)</code> as my DI framework.</p>
  
  <p>I am attempting to inject the following dependencies:-</p>
  
  <p>Inject Android Module A instances into the Main App</p>
  
  <p>Inject Java Module C instances into the Main App</p>
  
  <p>Inject Android Module D instances into the Main App</p>
  
  <p>Inject Android Module B instances into Android Module A</p>
  
  <p>Each Module has the following two Dagger related classes/interfaces</p>
  
  <pre><code>@Module
  public class ModuleX {
  
      @Singleton
      @Provides
      static ClassX provideClassX() {
          return new ClassXImpl();
      }
  
  }
  
  
  @Singleton
  @Component(modules = {ModuleX.class})
  public interface ClassXComponent {
  
  
  }
  </code></pre>
  
  <p>My Main Application has the following Dagger related classes/interfaces</p>
  
  <pre><code>@Module
  public abstract class MainActivityModule {
      @ContributesAndroidInjector
      abstract MainActivity contributeMainActivity();
  
      @ContributesAndroidInjector
      abstract Second contributeSecond();
  }
  
  
  @Singleton
  @Component(modules = {
          AndroidInjectionModule.class,
          MainActivityModule.class,
          ModuleA.class,
          ModuleB.class,
          ModuleC.class,
          ModuleD.class})
  public interface AppComponent {
  
      @Component.Builder
      interface Builder {
          @BindsInstance
          Builder application(Application application);
  
          AppComponent build();
      }
  
      void inject(MyApplication myApplication);
  }
  </code></pre>
  
  <p>This configuration successfully injects all my required dependencies apart from injecting
  Android Module B instances into Android Module A. Is it possible for Dagger2 to inject dependencies
  "between" modules?</p>
  
  <p>What am I missing to achieve my desired solution?</p>