title: How to use dagger 2 in a android library project
body: <p>I have a Core Android Library where I'm defining number of interfaces and its default implementations. All of them are exposed by CoreModule which is defined in CoreComponent.`</p>
  
  <p>Core module</p>
  
  <pre><code>@Module
  public class CoreModule {
  
  @Provides
  public IAuthenticationViewExtension provideToolsViewExtension() {
      return new AuthenticationViewExtension();
  }
  @Provides
  public ISettingsViewExtension provideISettingsViewExtension() {
      return new SettingsViewExtension();
  }
  }
  </code></pre>
  
  <p>Core component</p>
  
  <pre><code>@Component( modules = {CoreModule.class})
  public interface CoreComponent {
  CoreComponent coreComponent();
  void inject(BaseLauncher baseLauncher);
  ISettingsViewExtension iSettingsViewExtension();
  }
  </code></pre>
  
  <p>All implementations are injected only in Core library.</p>
  
  <p>There is also a Ui library which is dependent on Core library. Additionally, Ui library can provide a custom implementation to some of interfaces defined in Core library.  </p>
  
  <pre><code>├── Ui Library
    └── Core Library
  └── Core Library
  </code></pre>
  
  <p>In order to achieve the goal I have created a custom @component and @module in Ui library</p>
  
  <pre><code>@Component(dependencies = {UiComponent.class}, 
  modules = {UiModule.class})
  public interface UiComponent {
  }
  
  @Module
  public class DemoUiModule {
  @Provides
  public IAuthenticationViewExtension provideToolsViewExtension() {
      return new CustomAuthenticationViewExtension();
  }
  }
  </code></pre>
  
  <p>I think that the best solution to provide a custom implementation to Core library is be using a Subcomponent but, unfortunately, it doesn't seem possible because the Core Library has no visibility to the other libraries (Ui library and it's @component) , so I can't inject any of custom implementations in Core library.
  Any help?</p>