From the course: Android Dependency Injection with Dagger 2 and Kotlin

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Setting up a Dagger project

Setting up a Dagger project

From the course: Android Dependency Injection with Dagger 2 and Kotlin

Start my 1-month free trial

Setting up a Dagger project

- [Instructor] In previous videos I introduced Dagger and explained why you might want to add it to your application. The next step, of course, is to show you how to set up an Android application project to use Dagger. There are only four changes necessary to configure an Android project for Dagger. The first thing to do is to add the Kotlin KAPT plug-in to the application. I'm just going to copy and paste. There, next. We have to add some dependencies down here in the dependencies section. The first is a KAPT dependency. This is what makes Dagger an extension to the Kotlin compiler. I like to keep my Dagger version in a variable, you'll see it's up here, that way all of my Dagger things have the same version. The next dependency is the implementation dependency. Dagger has a small library of code and we need it in our application. Again I'm going to use the Dagger version that I've saved in this variable. The last change I need to make is actually optional. Most of Dagger code is…

Contents