title: Android Kotlin with Dagger2, lateinit var has not been initialized
body: <p>I'm a Dagger newb and have a trouble with using it.</p>
  
  <p>What I want to develop is that using RxAndroidBle and to initialize it by Dagger for providing Context.</p>
  
  <p>So I researched how it can be implemented, and I wrote some codes and It seems to be working for me but not working at all.</p>
  
  <p>The followings are my codes.</p>
  
  <p>AppComponent.kt</p>
  
  <pre><code>@Singleton
  @Component(modules = [
      AppModule::class,
      BluetoothModule::class,
      AndroidInjectionModule::class])
  interface AppComponent : AndroidInjector&lt;BluetoothController&gt; {
  
      @Component.Builder
      interface Builder {
  
          @BindsInstance
          fun application(app: Application): Builder
  
          fun build(): AppComponent
      }
  }
  </code></pre>
  
  <p>AppModule.kt</p>
  
  <pre><code>@Module
  class AppModule {
  
      @Provides
      @Named("appContext")
      @Singleton
      fun provideContext(application: Application): Context =
              application.applicationContext
  }
  </code></pre>
  
  <p>BluetoothModule.kt</p>
  
  <pre><code>@Module
  class BluetoothModule {
  
      @Provides
      @Named("rxBleClient")
      @Singleton
      fun provideRxBleClient(@Named("appContext") context: Context):RxBleClient =
              RxBleClient.create(context)
  }
  </code></pre>
  
  <p>BluetoothController.kt for injecting by DaggerApplication.</p>
  
  <pre><code>class BluetoothController : DaggerApplication() {
  
      override fun applicationInjector(): AndroidInjector&lt;out DaggerApplication&gt; {
          return DaggerAppComponent.builder().application(this).build()
      }
  }
  </code></pre>
  
  <p>I've inserted
  android:name".BluetoothController"
  to AndroidManifest.xml</p>
  
  <p>And this is how I would use it.</p>
  
  <pre><code>@field:[Inject Named("rxBleClient")]
  lateinit var rxBleClient: RxBleClient
  </code></pre>
  
  <p>But it always occurs an error says: lateinit property context has not been initialized</p>
  
  <p>What things I've missed? Can anyone help me?</p>
  
  <p>Thanks in advance.</p>