title: Kotlin + Dagger 2: Dagger* files won't generate
body: <p>I started using Kotlin and Dagger 2 together for the first time. I assumed everything is the same as in Java, but apparently, not quite. Dagger won't generate Dagger*files for me. Here is my code:</p>
  
  <p><strong>Components:</strong></p>
  
  <pre><code>@PerActivity
  @Subcomponent(modules = arrayOf(ApplicationModule::class))
  interface ActivityComponent {
      fun inject(app: OneAccountApplication)
  }
  </code></pre>
  
  <hr>
  
  <pre><code>@Singleton
  @Component(modules = arrayOf(ApplicationModule::class))
  interface ApplicationComponent {
  
  fun inject(syncService: SyncService)
  @ApplicationContext fun context(): Context
  fun application(): Application
  fun ribotsService(): OneAccountService
  fun preferencesHelper(): PreferencesHelper
  fun databaseHelper(): DatabaseHelper
  fun dataManager(): DataManager
  }
  </code></pre>
  
  <hr>
  
  <pre><code>@ConfigPersistent
  @Component(dependencies = arrayOf(ApplicationComponent::class))
  interface ConfigPersistentComponent {
      fun activityComponent(activityModule: ActivityModule): ActivityComponent
  }
  </code></pre>
  
  <hr>
  
  <p><strong>Modules:</strong></p>
  
  <pre><code>@Module
  class ActivityModule(private val mActivity: Activity) {
  
      @Provides
      internal fun provideActivity() = mActivity
  
      @Provides
      @ActivityContext
      internal fun providesContext() = mActivity
  }
  </code></pre>
  
  <hr>
  
  <pre><code>@Module
  class ApplicationModule(val mApplication: Application) {
  
      @Provides @Singleton
      internal fun provideApplication() = mApplication
  
      @Provides
      @ApplicationContext
      internal fun provideContext() = mApplication
  
      @Provides
      @Singleton
      internal fun provideOneAccountService() = OneAccountService.Creator.newOneAccountService()
  }
  </code></pre>
  
  <hr>
  
  <p><strong>Scope Annotations:</strong></p>
  
  <pre><code>@Qualifier
  @Retention(AnnotationRetention.RUNTIME)
  annotation class ActivityContext
  </code></pre>
  
  <hr>
  
  <pre><code>@Qualifier
  @Retention(AnnotationRetention.RUNTIME)
  annotation class ApplicationContext
  </code></pre>
  
  <hr>
  
  <pre><code>@Scope
  @Retention(AnnotationRetention.RUNTIME)
  annotation class ConfigPersistent
  </code></pre>
  
  <hr>
  
  <pre><code>@Scope
  @Retention(AnnotationRetention.RUNTIME)
  annotation class PerActivity
  </code></pre>
  
  <hr>
  
  <p>This is basically my whole DI system which I was using in my java code successfully. But with Kotlin, for some reason it does not work. I have also added: <code>apply plugin: 'kotlin-kapt'</code> to <code>gradle.build</code> like:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  apply plugin: 'kotlin-android'
  apply plugin: 'kotlin-kapt'
  </code></pre>
  
  <p>And in dependencies I have:</p>
  
  <pre><code>dependencies {
  
      final DAGGER_VERSION = '2.8'
      def daggerCompiler = "com.google.dagger:dagger-compiler:$DAGGER_VERSION"
      annotationProcessor daggerCompiler
      testAnnotationProcessor daggerCompiler
      androidTestAnnotationProcessor daggerCompiler
      compile  "com.google.dagger:dagger:$DAGGER_VERSION"
  }
  kapt {
      generateStubs = true
  }
  </code></pre>
  
  <p>Basically, this it <a href="https://github.com/ribot/android-boilerplate" rel="nofollow noreferrer">https://github.com/ribot/android-boilerplate</a> transformed into Kotlin.</p>