2

When I make changes to Dagger 2 components, I'd like it to rebuild the injection classes. But I don't want to run a whole project Rebuild because that takes 5 minutes, even with the gradle daemon.

In some cases it automatically rebuilds, but in other cases it doesn't.

What gradle task can I run to just re-create the Dagger 2 files?

Yervant
  • 225
  • 2
  • 8

1 Answers1

2

You need to generate the source files by running the apt plugin. This happens while compiling your sources. Use gradlew compileDebugSources to trigger the compilation or use Make Project in your IDE.

If you want to check the sources, you can see that it attaches itself to the javaCompile tasks.

Also see How to trigger the minimal task on Gradle to run apt plugin.

Community
  • 1
  • 1
David Medenjak
  • 33,993
  • 14
  • 106
  • 134