Dagger 2 not generating component in Android test project after upgrading to Kotlin 1.0.6

I upgraded an Android project from 1.0.5-3 to 1.0.6 and it now fails to build the test project but still builds the main project.

The error is: Error:(6, 23) Unresolved reference: DaggerTestComponent

The file giving the error is:

package com.example.kotlindaggerunittest

class TestApplication : MyApplication() {

    override fun buildDaggerGraph() {
        myComponent = DaggerTestComponent.builder().build()
        myComponent.inject(this)
    }

}

The component is:

package com.example.kotlindaggerunittest

import dagger.Component
import javax.inject.Singleton

@Singleton
@Component(modules = arrayOf(TestModule::class))
interface TestComponent : MyComponent {
    fun inject(myNonLifecycleClassTest: MyNonLifecycleClassTest)
}

The main application which works is:

package com.example.kotlindaggerunittest

import android.app.Application

open class MyApplication : Application() {

    companion object {
        lateinit var myComponent: MyComponent
    }

    override fun onCreate()  {
        buildDaggerGraph()
    }

    open fun buildDaggerGraph() {
        myComponent = DaggerMyComponent.builder().build()
        myComponent.inject(this)
    }

    fun component(): MyComponent {
        return myComponent
    }

}

The main component that is extended is:

package com.example.kotlindaggerunittest

import com.example.kotlindaggerunittest.analytics.ThirdPartyAnalyticsWrapper
import com.example.kotlindaggerunittest.analytics.ThirdPartyAnalyticsWrapperHolder
import dagger.Component
import javax.inject.Singleton

@Singleton
@Component(modules = arrayOf(MyModule::class))
interface MyComponent {
    fun inject(myApplication: MyApplication)
    fun inject(mainActivity: MainActivity)
    fun inject(myNonLifecycleClass: MyNonLifecycleClass)
    fun inject(thirdPartyAnalyticsWrapper: ThirdPartyAnalyticsWrapper)
    fun inject(thirdPartyAnalyticsWrapperHolder: ThirdPartyAnalyticsWrapperHolder)
}

This is a minimal example project extracted from a large production project. I’m happy to send the whole example project.

Commenting out this line in the app build.gradle file when using Kotlin 1.0.5-3 gives the same error:

kaptTest 'com.google.dagger:dagger-compiler:2.8'

This would suggest that kaptTest is what isn’t working.

I have added the test project I created to the ticket for this issue: https://youtrack.jetbrains.com/issue/KT-15459