I've tried implementing Jake Wharton's AssistedInject
with Dagger 2 (https://github.com/square/AssistedInject) in my project.
My code is pretty much identical to https://github.com/square/AssistedInject/tree/master/inflation-inject-sample/src/main/java/com/example but I get the error:
error: cannot find symbol @dagger.Module(includes = {InflationInject_ViewModule.class})
It seems like ViewModule
generated code doesn't know where to find InflationInject_ViewModule
:
@InflationModule
@Module(includes = [InflationInject_ViewModule::class])
abstract class ViewModule
The relevant bits of my build.gradle are
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {...}
dependencies {
implementation "com.google.dagger:dagger-android:2.16"
implementation "com.google.dagger:dagger-android-support:2.16"
kapt "com.google.dagger:dagger-compiler:2.16"
kapt "com.google.dagger:dagger-android-processor:2.16"
implementation 'com.squareup.inject:inflation-inject:0.3.0'
kapt 'com.squareup.inject:inflation-inject-processor:0.3.0'
}
I have checked that InflationInject_ViewModule
does exist in generated code (at build/generated/source/kapt/devDebug/com/project/di/
, so maybe it's something to do with where the compiler looks for source sets / generated code.
Any suggestions?