Simplest way I found:
-
Add
ideaplugin and add Dagger2 dependency like below:plugins { id "net.ltgt.apt" version "0.10" } apply plugin: 'java' apply plugin: 'idea' sourceCompatibility = 1.8 repositories { mavenCentral() } dependencies { testCompile group: 'junit', name: 'junit', version: '4.12' compile 'com.google.dagger:dagger:2.11' apt 'com.google.dagger:dagger-compiler:2.11' } -
Turn on
Annotation Processingfor IntelliJ: Go toSettingsand search forAnnotation Processors, check Enable annotation processing like below image:
