dagger-2-testing-demo
dagger-2-testing-demo copied to clipboard
cannot find symbol variable DaggerTestMyApplication_TestApplicationComponent
Error:(17, 21) error: cannot find symbol variable DaggerTestMyApplication_TestApplicationComponent
Hey, just in case anybody else having the same issue - after hour of googling and digging into Google discussion group. The solution is:
- Add
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
tobuild.gradle
at top level. - Add
apply plugin: 'com.neenbedankt.android-apt'`` to
build.gradle``` at app level. - Add
testApt "com.google.dagger:dagger-compiler:YOUR_VERSION"
tobuild.gradle
at app level.
Now everything should be generated correctly after rebuild.
I have defined the TestApplicationComponent outside of my TestApplication class. But now i have an issue when i call DaggerTestApplicationComponent.builder()
, it doesn't recognize the DaggerTestApplicationComponent. Why is that?