mercredi 29 juin 2016

Unresolved reference: DaggerTestComponent (Kotlin with Dagger for Test)

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://ift.tt/29obx6o

When I try to perform testing using Dagger, and generate the DaggerTestComponent.builder() as per http://ift.tt/293uTPP or even http://ift.tt/29oaZ0m, in Kotlin language, but have the below error

Error:(14, 25) Unresolved reference: DaggerTestComponent

I found http://ift.tt/293uVHv 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?

Aucun commentaire:

Enregistrer un commentaire