dagger dependency injection java code example

Example 1: dagger dependency maven dependency

// https://mvnrepository.com/artifact/com.google.dagger/dagger
compile group: 'com.google.dagger', name: 'dagger', version: '2.0'

Example 2: dagger kapt dependency and plugin

#Plugin
apply plugin: 'kotlin-kapt'

#dependencies
implementation 'com.google.dagger:dagger:2.11'
kapt 'com.google.dagger:dagger-compiler:2.11'

#Plugin for android
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

#dependencies
provided 'javax.annotation:jsr250-api:1.0'

Tags:

Java Example