Dagger-Hilt: [Dagger/MissingBinding] Object from external Module cannot be provided without an @Inject constructor or an @Provides-annotated method

Published

I am using an AuthenticationRequest object from an external module in my app module. I supply this object as a dependency to my AccountRepository. This is how I have defined my dependency in the app module.

@InstallIn(SingletonComponent::class)
@Module
class ApplicationModule {

@Provides
@Singleton
fun provideRepository(
    authenticationRequest: AuthenticationRequest,
    accountDao: AccountDao
) = AccountRepository(authenticationRequestFactory, accountDao)

}

And the AccountRepository:

class AccountRepository @Inject constructor(
   private val authenticationRequestFactory: AuthenticationRequestFactory,
   private val accountDao: AccountDao
) {....}

But I am getting the following error message:
Dagger/MissingBinding] com.external.auth.AuthenticationRequest cannot be provided without an @Inject constructor or an @Provides-annotated method.

How do I correctly inject the AuthenticationRequest object? Note that the module where this object is defined does not use Dagger-Hilt. Any pointers would be great.

Source: Android Questions

Published
Categorized as android, dagger-2, dagger-hilt

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq