Hello Everyone/Anyone,
While I am still finding my way around Android development, I have taken up the Now in Android Multi Module App as a reference point to implement a conceptual app. My current struggle lies in implementing the android instrumented test for my compose component(s).
Below are images of my [within the context of the issue here]
- app directory structure
- app classes/files
| Code Snippets | Folder Structure |
| --- | --- |
| code snippet diagram source
|
app structure diagram source
Issue:
When I attempt to build/compile the project, I get the hilt/dagger exceptions:
ContactUIComponentsTest_HiltComponents.java:151: error: [Dagger/MissingBinding] CerpsysAddressRepository cannot be provided without an @Provides-annotated method.
public abstract static class SingletonC implements FragmentGetContextFix.FragmentGetContextFixEntryPoint,
^
Missing binding usage:
CerpsysAddressRepository is injected at
CerpsysAddressRegistrationUseCase(cerpsysAddressRepository)
CerpsysAddressRegistrationUseCase is injected at
CerpsysAddressViewModel(�, addressRegistrationUseCase, �)
CerpsysAddressViewModel is injected at
CerpsysAddressViewModel_HiltModules.BindsModule.binds(arg0)
@dagger.hilt.android.internal.lifecycle.HiltViewModelMap java.util.Map<java.lang.String,javax.inject.Provider<androidx.lifecycle.ViewModel>> is requested at
dagger.hilt.android.internal.lifecycle.HiltViewModelFactory.ViewModelFactoriesEntryPoint.getHiltViewModelMap() [dagger.hilt.android.internal.testing.root.ContactUIComponentsTest_HiltComponents.SingletonC ? dagger.hilt.android.internal.testing.root.ContactUIComponentsTest_HiltComponents.ActivityRetainedC ? dagger.hilt.android.internal.testing.root.ContactUIComponentsTest_HiltComponents.ViewModelC]
It is also requested at:
CerpsysAddressFuzzySearchUseCase(cerpsysAddressRepository)
FindCerpsysAddressByInternalUUIDUseCase(cerpsysAddressRepository)
Note: when I remove all the test bindings classes e.g. TestDataModule.kt, my app runs fine.
From my implementation, I have initially used in my TestDataModule.kt
@Binds
@Singleton
abstract fun bindsCerpsysAddressRepository(
cerpsysAddressRepository: DefaultCerpsysAddressRepository
): CerpsysAddressRepository
and changed to
@Provides
@Singleton
fun bindsCerpsysAddressRepository(
db:EndviscrmuxDatabase,
networkDataSource: EndviscrmNetworkDataSource,
cerpsysAddressDao: CerpsysAddressResourceDao,
@CerpsysDispatcher(EndviscrmDispatchers.IO) ioDispatcher: CoroutineDispatcher,
): CerpsysAddressRepository {
return DefaultCerpsysAddressRepository(cerpsysAddressDao,networkDataSource,ioDispatcher)
}
but the compile time error persists.
Any guidance will be appreciated as I'm kind of stuck now.
