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.gradleat top level. - Add
apply plugin: 'com.neenbedankt.android-apt'`` tobuild.gradle``` at app level. - Add
testApt "com.google.dagger:dagger-compiler:YOUR_VERSION"tobuild.gradleat 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?