Posted on Leave a comment

Dagger test, androidTest component generated code

to allow Dagger to generate code in test and androidTest folders we should add dependencies test and androidTest to gradle.

Dagger test component not found

Espresso Dagger

Dagger not generating components for /test class

if we use apt

[code]
// for androidTest
androidTestApt ‘com.google.dagger:dagger-compiler:<version>’

// for unit test
testApt ‘com.google.dagger:dagger-compiler:<version>’
[/code]

if we use annotationProcessor

[code]
androidTestAnnotationProcessor ‘com.google.dagger:dagger-compiler:<version>’
testAnnotationProcessor ‘com.google.dagger:dagger-compiler:<version>’
[/code]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.