Cannot find symbol class "Generated" for Dagger 2

TL;DR use Dagger >= 2.1

Alex is right, but it's better to add JSR250 dependency instead of GlassFish

provided 'javax.annotation:jsr250-api:1.0'

or for the latest gradle plugin:

compileOnly 'javax.annotation:jsr250-api:1.0'

Read this for more info: https://github.com/google/dagger/issues/95

Basically, the solution is to do what you've already done which is include the glassfish javax annotation library.


This happens if your JAVA_HOME points to JAVA version 9 or 10. Switching JAVA_HOME to Java 8 fixes the problem and you will not need that extra dependency.