[英]Android Dagger 2.11 with Kotlin, ContributesAndroidInjector Annotation issue
I'm using Dagger 2.11
with Kotlin
. 我在
Kotlin
使用Dagger 2.11
。 Everything is fine with Dagger
but when i add ContributesAndroidInjector
annotation to project i get this error: 用
Dagger
一切都很好,但是当我向项目添加ContributesAndroidInjector
批注时,出现此错误:
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. 不是:我已经尝试清洁Gradle和重建项目。
The problem is about my dependencies. 问题是关于我的依赖关系。 Here're the working dependencies for
Dagger 2.11
and Kotlin
. 这是
Dagger 2.11
和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. 谢谢大家的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.