Kotlin

Kotlin with dagger-android basic setup

Since dagger-android is fairly new, every article on the Internet shows the “old” way of incorporating Dagger 2 into your Kotlin app, which involves writing some amounts of boilerplate code (well, so does any app using dagger, but at least with the addition of dagger-android you can try to cut it down a bit). While for seasoned veterans it may be simple, I thought that, especially for less experienced developers, a fully working example could be useful. This is an example of the most basic setup using dagger-android in Kotlin. Update (2018-02-24): When this guide was first written it was using 2.11-rc2 version of dagger. Dagger extensions for Android have evolved since and now it’s even easier to set things up. Below you can find the updated guide using version 2.12.
Read more