I am learning Dagger 2 from this site https://developer.android.com/training/dependency-injection/dagger-android. I am creating like this,
Appcomponent.java
@Singleton
@Component(modules = {AppModule.class, AuthModule.class})
public interface AppComponent {
AuthComponent.Factory authComponent();
}
AppModule.java
@Module
public class AppModule
{}
AuthComponent.java
@FeatureScope
@Subcomponent
public interface AuthComponent {
@Subcomponent.Factory
interface Factory{
AuthComponent create();
}
}
AuthModule.java
@Module(subcomponents = AuthComponent.class)
public class AuthModule {
}
But I got the error,AuthComponent doesn't have a @Subcomponent.Builder, which is required when used with @Module.subcomponents @Module(subcomponents = AuthComponent.class)
I am doing as the documentation. Please help me explain with my error.
Edit This is my dagger version.
//di
api 'com.google.dagger:dagger-android:2.35.1'
api 'com.google.dagger:dagger:2.35.1'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.20'
annotationProcessor 'com.google.dagger:dagger-compiler:2.20'