John R.webp

Dagger + Anvil: Learning to Love Dependency Injection

Gabriel Peal & Ralf Wondratschek

Android engineer & Software Engineer

Tonal & Square

This is a joint talk with Ralf Wondratschek from Square and Gabriel Peal from Tonal.

Anvil is a Kotlin compiler plugin that makes dependency injection with Dagger 2 easier. Anvil reduces boilerplate code, improves code modularization, reduces build times, and enables custom code generators to further simplify patterns specific to your codebase.

In this talk we will explain why Square created Anvil, how Tonal successfully adopted it, how the plugin works under the hood, what code is being generated and how you can get the most out of the framework.

Gabriel is an Android engineer at Tonal (
Previously, he worked at Airbnb and Google.
At Airbnb, he supported 70 product engineers to ensure that the Android app is stable and fun to develop for. He also worked on the React Native infrastructure for a year.
At Google, he helped take Android Auto from ideas on a whiteboard to car dealerships around the world.

He also wrote Lottie for Android and is a co-maintainer and owner of MvRx.

Droidcon NYC 2018
Craft Conf 2018
Droidcon NYC 2017
AnDevCon DC 2017
Google I/O 2014

Fragmented (x2)
Talking Kotlin
Android Developers Backstage
Software Engineering Daily (x2)

Author of:

Ralf is a software engineer at Square. He maintains several open-source projects on Github, e.g. android-job, which is used by many other companies like Twitter, Dropbox, Square, Pocket and The New York Times.

Prior to Square, Ralf worked at Evernote and several several companies in Germany and published as independent developer four apps in the Google Play Store.