Cannot find symbol class “Generated” for Dagger 2

帅比萌擦擦* 提交于 2019-12-03 22:17:56

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.

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'

The right answer today is to use a version of dagger which is greater than 2.1 (because of the fix mentioned by @tomrozb is integrated in 2.1)

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!