title: Dagger: A binding with matching key exists in component
body: <p>I am using Dagger 2.16 and was following <a href="https://medium.com/@iammert/new-android-injector-with-dagger-2-part-2-4af05fd783d0" rel="nofollow noreferrer">this</a> article for my dagger implementation. Everything was working fine with this implementation until I had only one Activity(HomeActivity). As soon as I started implementing Dagger in SplashScreenActivity. I started getting this error. Here is some code from my project</p>
  
  <p><strong>AppComponent.kt</strong></p>
  
  <pre><code>@Singleton
  @Component(modules = [
      AndroidInjectionModule::class,
      AppModule::class,
      ActivityBuilder::class,
      ServiceBuilder::class,
      BroadcastRecieverBuilder::class])
  interface AppComponent : AndroidInjector&lt;MyApp&gt; {
      @Component.Builder
      abstract class Builder : AndroidInjector.Builder&lt;MyApp&gt;()
  }
  </code></pre>
  
  <p><strong>AppModule.kt</strong></p>
  
  <pre><code>@Module()
  class AppModule {
  
      @Provides
      @Singleton
      fun provideContext(application: MyApp): Context {
          return application
      }
  
      @Provides
      @Singleton
      fun provideRestService(retrofit: Retrofit): RestService {
          return retrofit.create(RestService::class.java)
      }
      ...
  }
  </code></pre>
  
  <p><strong>ActivityBuilder.kt</strong></p>
  
  <pre><code>@Module
  abstract class ActivityBuilder {
  
      @ContributesAndroidInjector(modules = [HomeActivityModule::class])
      @PerActivity
      abstract fun bindHomeActivity(): HomeActivity
  
      @ContributesAndroidInjector(modules = [SplashScreenModule::class])
      @PerActivity
      abstract fun bindSplashActivity(): SplashScreenActivity
  }
  </code></pre>
  
  <p><strong>BaseActivity.kt</strong></p>
  
  <pre><code>abstract class BaseActivity&lt;V : BaseView, P : MvpBasePresenter&lt;V&gt;&gt; :
          MvpActivity&lt;V, P&gt;(), BaseView, HasSupportFragmentInjector {
      @Inject
      lateinit var fragmentInjector: DispatchingAndroidInjector&lt;Fragment&gt;
  
      @Inject
      lateinit var mPresenter: P
  
      override fun onCreate(savedInstanceState: Bundle?) {
          AndroidInjection.inject(this)
          super.onCreate(savedInstanceState)
      }
  
      override fun createPresenter(): P = mPresenter
  
      override fun supportFragmentInjector(): AndroidInjector&lt;Fragment&gt; {
          return fragmentInjector
      }
  }
  </code></pre>
  
  <p>I have my own BaseActivity instead of DaggerActivity because I what to inherit from mosby's MvpActivity.</p>
  
  <p><strong>SplashScreenModule.kt</strong></p>
  
  <pre><code>@Module
  abstract class SplashScreenModule {
  
      @Binds
      @PerActivity
      internal abstract fun splashPresenter(splashPresenter: SplashScreenPresenter): BasePresenter&lt;*&gt;
  }
  </code></pre>
  
  <p><strong>HomeActivityModule.kt</strong></p>
  
  <pre><code>@Module
  abstract class HomeActivityModule {
  
      @Binds
      @PerActivity
      internal abstract fun homePresenter(homePresenter: HomeActivityPresenter): BasePresenter&lt;*&gt;
  
      @ContributesAndroidInjector(modules = [DownloadFragmentModule::class])
      @PerFragment
      internal abstract fun downloadsFragment(): DownloadsFragment
  }
  </code></pre>
  
  <p>Now when I build this, I get an error as follows</p>
  
  <pre><code>error: [Dagger/MissingBinding] [dagger.android.AndroidInjector.inject(T)] java.util.Map&lt;java.lang.Class&lt;? extends android.support.v4.app.Fragment&gt;,javax.inject.Provider&lt;dagger.android.AndroidInjector.Factory&lt;? extends android.support.v4.app.Fragment&gt;&gt;&gt; cannot be provided without an @Provides-annotated method.
  public abstract interface AppComponent extends dagger.android.AndroidInjector&lt;com.realtime.app.MyApp&gt; {
                  ^
    A binding with matching key exists in component: com.realtime.dagger.ActivityBuilder_BindHomeActivity.HomeActivitySubcomponent
        java.util.Map&lt;java.lang.Class&lt;? extends android.support.v4.app.Fragment&gt;,javax.inject.Provider&lt;dagger.android.AndroidInjector.Factory&lt;? extends android.support.v4.app.Fragment&gt;&gt;&gt; is injected at
            dagger.android.DispatchingAndroidInjector.&lt;init&gt;(injectorFactories)
        dagger.android.DispatchingAndroidInjector&lt;android.support.v4.app.Fragment&gt; is injected at
            com.realtime.core.BaseActivity.fragmentInjector
        com.realtime.splashScreen.SplashScreenActivity is injected at
            dagger.android.AndroidInjector.inject(T)
    component path: com.realtime.dagger.AppComponent → com.realtime.dagger.ActivityBuilder_BindSplashActivity.SplashScreenActivitySubcomponent
  </code></pre>
  
  <p>I have gone through other similar que like <a href="https://stackoverflow.com/questions/47106818/dagger-2-11-a-binding-with-matching-key-exists-in-component">this</a> but couldn't relate it to what I am facing. What am I missing?</p>
  
  <p><strong>Update:</strong> For now I am not inheriting BaseActivity in SplashScreenActivity so that I can avoid injecting <code>fragmentInjector: DispatchingAndroidInjector&lt;Fragment&gt;</code>. It is working for now as I don't have any fragment in SplashScreenActivity.</p>