title: Problem with injecting of dagger subcomponent into activity
body: <p>I have a hard time figuring out how to set up Dagger component hierarchy to match my vision. Any help would be greatly appreciated and please feel free to criticise the vision if you find any holes in it.</p>
  
  <p>Let's get to the point.</p>
  
  <p>I'm trying to redesing part of my application related to user registration. Since registration is a self contained domain I assume that it's a good candidate for a separate dagger component(RegistrationSubcomponent). Within that registration domain I will show an activity(RegistrationActivity) and on top of it few fragments(RegistrationFragment1, RegistrationFragment2, ...). I already have an application component(AppComponent) with the life scope of an application which should be a parent for RegistrationSubcomponent. AppComponent is used to inject dependecies into other activites excluding RegistrationActivity but also to a common activity(CommonActivity) which is a parent for every activity in my app including RegistrationActivity. To inject dependencies into RegistrationActivity i want to use RegistrationSubcomponent.</p>
  
  <p>The RegistrationSubcomponent should be instantiated shortly before displaying RegistrationActivity and should live until after the RegistrationActivity returns. I dont't want to bind RegistrationSubcomponent lifecycle with RegistrationActivity lifecycle. Mayby in this case it may have sense but in future I will probably would like to create components for other app domains which may not neceserralily match the lifecycle of activities they encompass.</p>
  
  <p>In general the problem is injection of dependecies specfied in RegistrationComponent into RegistrationActivity as well as to RegistrationFragments.</p>
  
  <p>The problem is that the app crashes when navigating to RegistrationActivity with following error:
  Unable to start activity ComponentInfo{pl.kermit.diproblem/pl.kermit.diproblem.activities.RegistrationActivity}: java.lang.IllegalArgumentException: No injector factory bound for Class</p>
  
  <p>Minimal project presenting the problem can be found at <a href="https://github.com/mariola3000/DIProblemStack01" rel="nofollow noreferrer">https://github.com/mariola3000/DIProblemStack01</a></p>
  
  <p>Below I put the most important parts of code</p>
  
  <p>// APP COMPONENT</p>
  
  <pre><code>@Singleton
  @Component(modules = [AndroidInjectionModule::class, AppModule::class, AppAndroidBindingModule::class,
      AndroidSupportInjectionModule::class])
  interface AppComponent {
      @Component.Builder
      interface Builder {
  
          @BindsInstance
          fun application(application: Application): Builder
  
          fun build(): AppComponent
      }
  
      fun inject(application: Application)
  }
  
  @Module(subcomponents = [RegistrationComponent::class])
  class AppModule {
      @Provides
      fun provideGlobalDependency(): GlobalDependency {
          return GlobalDependency("GlobalDependency")
      }
      @Provides
      fun provideGlobal2Dependency(): Global2Dependency {
          return Global2Dependency("Global2Dependency")
      }
  }
  
  @Module
  abstract class AppAndroidBindingModule {
  
      @PerActivity
      @ContributesAndroidInjector()
      abstract fun bindMainActivity(): MainActivity
  
  }
  </code></pre>
  
  <p>// REGISTRATION COMPONENT</p>
  
  <pre><code>@PerRegistration
  @Subcomponent(modules = [RegistrationModule::class, RegistrationAndroidBindingModule::class])
  interface RegistrationComponent {
      @Subcomponent.Builder
      interface Builder {
          fun requestModule(module: RegistrationModule): Builder
          fun build(): RegistrationComponent
      }
  }
  
  @Module
  class RegistrationModule {
      @PerRegistration
      @Provides
      fun provideRegistrationDependency(): RegistrationDependency {
          return RegistrationDependency("RegistrationDependency")
      }
  
      @PerRegistration
      @Provides
      fun provideRegistrationFragmentDependency(): RegistrationFragmentDependency {
          return RegistrationFragmentDependency("RegistrationFragmentDependency")
      }
  }
  
  @Module
  abstract class RegistrationAndroidBindingModule {
      @PerActivity
      @ContributesAndroidInjector
      abstract fun bindRegistrationActivity(): RegistrationActivity
  
      @PerFragment
      @ContributesAndroidInjector
      abstract fun bindRegistrationFragment(): RegistrationFragment
  }
  </code></pre>
  
  <p>// ACTIVITIES</p>
  
  <pre><code>abstract class CommonActivity : DaggerAppCompatActivity(){
      @Inject
      lateinit var globalDependency: GlobalDependency
  
      override fun onCreate(savedInstanceState: Bundle?) {
          AndroidInjection.inject(this)
          super.onCreate(savedInstanceState)
  
          Toast.makeText(this, "global message: " + globalDependency.message, Toast.LENGTH_LONG).show()
      }
  }
  
  class MainActivity : CommonActivity() {
      @set:Inject
      lateinit var global2Dependency: Global2Dependency
  
      override fun onCreate(savedInstanceState: Bundle?) {
          AndroidInjection.inject(this)
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
          val text: TextView = findViewById(R.id.main_text)
  
          text.text = global2Dependency.message
  
          val button: Button = findViewById(R.id.main_button)
          button.setOnClickListener {
              startActivity(Intent(this, RegistrationActivity::class.java))
          }
      }
  }
  
  class RegistrationActivity : CommonActivity() {
      @Inject
      lateinit var registrationDependency: RegistrationDependency
  
      override fun onCreate(savedInstanceState: Bundle?) {
          AndroidInjection.inject(this)
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_registration)
  
          val registrationMessage = findViewById&lt;TextView&gt;(R.id.registration_text)
          registrationMessage.text = registrationDependency.message
  
          val transaction = this.supportFragmentManager.beginTransaction()
          val fragment = RegistrationFragment()
          transaction.replace(R.id.registration_fragment_container, fragment)
          transaction.addToBackStack(fragment.javaClass.simpleName)
          transaction.commit()
      }
  }
  </code></pre>