简体   繁体   中英

Android Dagger 2.11 with Kotlin, ContributesAndroidInjector Annotation issue

I'm using Dagger 2.11 with Kotlin . Everything is fine with Dagger but when i add ContributesAndroidInjector annotation to project i get this error:

e: 
...build/tmp/kapt3/stubs/devDebug/com/raqun/android/di/AppComponent.java:6: error: dagger.internal.codegen.ComponentProcessor was unable to process this interface because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code.
e: 

e: public abstract interface AppComponent extends dagger.android.AndroidInjector<MyApp> {
e:  

Here're the dependencies i use:

$rootProject.ext.daggerVersion = 2.11

compile "com.google.dagger:dagger-android:$rootProject.ext.daggerVersion"
compile "com.google.dagger:dagger-android-support:$rootProject.ext.daggerVersion"
kapt "com.google.dagger:dagger-compiler:$rootProject.ext.daggerVersion"
annotationProcessor "com.google.dagger:dagger-android-processor:$rootProject.ext.daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.ext.daggerVersion"

I already added:

kapt {
    generateStubs = true
}

and

apply plugin: 'kotlin-kapt'

What i'm missing or doing wrong? Thanks for your help.

Not: I already tried cleaning gradle and re-building project.

The problem is about my dependencies. Here're the working dependencies for Dagger 2.11 and Kotlin .

compile "com.google.dagger:dagger-android-support:$rootProject.ext.daggerVersion"
kapt "com.google.dagger:dagger-compiler:$rootProject.ext.daggerVersion"
kapt "com.google.dagger:dagger-android-processor:$rootProject.ext.daggerVersion"

Thanks all for help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM