When we use Dagger and Kotlin, we'll need the following in our build.gradle dependency
kapt 'com.google.dagger:dagger-compiler:2.0'
compile 'com.google.dagger:dagger:2.0'
provided 'org.glassfish:javax.annotation:10.0-b28'
As stated in http://www.beyondtechnicallycorrect.com/2015/12/30/android-kotlin-dagger/
When I try to perform testing using Dagger, and generate the DaggerTestComponent.builder()
as per https://labs.ribot.co.uk/fast-and-reliable-ui-tests-on-android-17c261b8220c#.o3efc5knx or even https://medium.com/@fabioCollini/android-testing-using-dagger-2-mockito-and-a-custom-junit-rule-c8487ed01b56#.hxtytfns3, in Kotlin language, but have the below error
Error:(14, 25) Unresolved reference: DaggerTestComponent
I found https://stackoverflow.com/a/36231516/3286489 which explain how to get DaggerTestComponent generated, and try put the below in my dependency.
androidTestApt 'com.google.dagger:dagger-compiler:2.0.1'
Apparently, I think this is for Java and not Kotlin, so the issue persist. Is there a Kotlin version of it? How to get my DaggerTestComponent
generated in my Kotlin project?