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)
}
The constructor for AuthenticationRequest
in the external module:
class AuthenticationRequest(
api: AuthenticationApi,
apiError : ApiError = ApiErrorImpl()
) : Request<AuthenticationApi>(api, apiError)
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. It uses Dagger-2 though. Any pointers would be great.
Note: Project Structure is
|-- :app
-- :external module