Issue
I'm trying to use Dagger2 in my android project as explained in hitherejoe/Android-Boilerplate. While I am setting up the project I got following error on build time.
Error:(30, 26) error: cannot find symbol variable DaggerTestComponent
After digging into the documentation and generated code I figured out that code is not generating in debug (/app/build/generated/source/apt/debug/) folder but in test/debug(/app/build/generated/source/apt/test/debug) folder. So in my test source folder can not import the generated DaggerTestComponent.
Any clue how to include test/debug folder to the source? My dependancies are as follows
testCompile 'com.neenbedankt.gradle.plugins:android-apt:1.8'
compile "com.google.dagger:dagger:$DAGGER_VERSION"
apt "com.google.dagger:dagger-compiler:$DAGGER_VERSION"
provided 'javax.annotation:jsr250-api:1.0'
compile 'javax.inject:javax.inject:1'
testApt "com.google.dagger:dagger-compiler:$DAGGER_VERSION"
Thanks in advance.
Solution
I had the same problem... I worked around it by adding the generated test source directory:
android {
sourceSets {
// add dagger generated files (works only with debug build)
test.java.srcDirs += ['build/generated/source/apt/test/debug']
}
}
Answered By - Jeff Campbell
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.