I am facing a problem when I put the @Named annotation in the AppModule and here is my code, The problem appears only when I add the @Named annotation to both the 'AppModule' and the 'IdentityRepository', but when I remove it from both everything is fine
Note that I have to use @Named because I want to create a second function with the same DataType in the same Module
@Module
object AppModule {
...
@Provides
@JvmStatic
@Singleton
@Named("NOT_AUTH_IDENTITY_SERVICE")
fun provideIdentityService(retrofit: Retrofit): IdentityService =
retrofit.create(IdentityService::class.java)
}
and when I use it the IdentityRepository
class IdentityRepository @Inject constructor() {
@Inject
@Named("NOT_AUTH_IDENTITY_SERVICE")
lateinit var identityService: IdentityService
...
}
I am facing this error
error: [Dagger/MissingBinding] solutions IdentityService cannot be provided without an @Provides-annotated method. public abstract interface AppComponent extends dagger.android.AndroidInjector { ...