What Dagger Slowdive Actually Does For Your Project

If you are working with Dagger on a medium to large Android or Java project, you have probably noticed that wiring up modules, components, and subcomponents gets tedious fast. Slowdive is a Gradle plugin that automates some of the boilerplate generation around Dagger components. Instead of manually writing component interfaces or dealing with repetitive module declarations, Slowdive scans your codebase and generates the connections for you. I started using it about two years ago when our project had roughly forty modules and a component hierarchy that was becoming unmaintainable. Every time we added a new scope or module, we had to manually update multiple interface definitions. It was error-prone and slow. Slowdive cut that maintenance time down significantly, though it did not eliminate it entirely. You still need to understand what Dagger is doing under the hood, because the plugin only generates so much.

Unravel The Mystery Of Dagger Slowdive A Dive Into The World Of Meaning And Significance

At its core, Slowdive replaces the need for hand-written component interfaces in many common patterns. It reads your module annotations and your existing dependency declarations, then produces the component and subcomponent classes that Dagger normally requires you to write by hand. The key configuration happens in your build.gradle file where you declare the plugin and point it at your source sets. The typical setup looks like this: you add the plugin to your buildscript dependencies, apply it to your module, and annotate your existing Dagger modules with the appropriate Slowdive annotations. Then you run the Gradle sync and the generated code appears in your build/generated/source directory. It follows the standard Dagger naming conventions, so IDE navigation works as expected. Here is a detail that most documentation glosses over. Slowdive does not handle scoping conflicts the way a human would. If two modules you include in the same component both provide bindings for the same type with incompatible scopes, the plugin will generate code that compiles but will throw a runtime error at component creation time. I ran into this exact issue when merging two feature modules that each had their own ApplicationScope binding for a cache object. The build succeeded, everything looked fine, and then the app crashed on startup with a confusing dagger error message. The workaround was to inspect the generated component file directly and trace which two modules were contributing conflicting providers, then adjust the scope annotations on one of them. It took maybe twenty minutes once I knew where to look.

One counter-intuitive thing about Slowdive that trips up a lot of people: it does not replace the need for @Module and @Component annotations on your existing code. It augments them. You still need to declare which modules a component includes and which subcomponents it owns, but you do not need to write the component interface itself if you use the plugin's annotation-based approach. This distinction matters because some teams treat Slowdive as a drop-in replacement for Dagger's manual wiring, which it is not. It is a code generator for the patterns that Dagger already supports. Another practical consideration is build time. When your project is small, Slowdive adds maybe three to five seconds to each Gradle sync. Once you cross roughly twenty-five modules with complex interdependencies, that number can climb to thirty or forty seconds during a clean build. Incremental builds are faster because the plugin detects which modules changed and only regenerates the affected component code. Still, if you are iterating rapidly on component structure, the wait can feel noticeable. I keep the Gradle daemon running and use incremental builds exclusively, which brings the typical iteration cycle down to around ten seconds. There is also a limitation worth being honest about. Slowdive works best with standard Dagger patterns. If your project uses custom component factories, dynamic component creation, or highly unconventional scope hierarchies, the plugin may not generate the code you need correctly. In those cases, falling back to manual component definitions alongside Slowdive-generated ones is the practical approach. I have seen teams try to force the plugin into non-standard configurations and end up with generated code that is harder to debug than if they had just written the component by hand.

Get the Full Details

DAGGER - Slowdive - LETRAS.COM
DAGGER - Slowdive - LETRAS.COM

For installation, you add the dependency to your root build.gradle or settings.gradle depending on the version, apply the plugin in the module that owns your main component hierarchy, and then annotate your entry-point Dagger module with the appropriate Slowdive annotation. The plugin documentation lists the exact Maven coordinates, and they update with each release. Make sure you are running a recent version because earlier releases had issues with Kotlin multi-module projects. The tradeoff is straightforward. Slowdive saves time on routine component setup and reduces boilerplate errors, but it introduces a layer of indirection that can make debugging harder when things go wrong. If your project is small or your dependency graph is simple, the manual approach may be clearer and just as fast. If you are maintaining a large codebase with frequent module additions and removals, the automation pays for itself within a few weeks of use.