ogulcan / kotlin-mvp-dagger2

This example application implements MVP architecture using Kotlin, Dagger2, RxJava2 and also inject, constraint-layout, typicode api.
https://medium.com/@ogulcan/kotlin-mvp-dagger-2-retrofit-sample-android-application-e6fe3af7acd
GNU General Public License v3.0
154 stars 53 forks source link

DaggerApplicationComponent missing #3

Open nosavvy33 opened 5 years ago

nosavvy33 commented 5 years ago

In BaseApp, this class is being called, but no DaggerApplicationComponent can be found inside di.module package

vassalloandrea commented 5 years ago

@nosavvy33

In build gradle file:

Add kotlin-kapt plugin

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

Add kapt in dependencies like

implementation "com.google.dagger:dagger:$dagger2_version"
implementation "com.google.dagger:dagger-android:$dagger2_version"
implementation "com.google.dagger:dagger-android-support:$dagger2_version"
kapt "com.google.dagger:dagger-compiler:$dagger2_version"
kapt "com.google.dagger:dagger-android-processor:$dagger2_version"
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
compileOnly 'javax.annotation:jsr250-api:1.0'
implementation 'javax.inject:javax.inject:1'

Add this at the end of the file

kapt {
    generateStubs = true
}

Compile the project and now you can import DaggerApplicationComponent