I'm was starting to using hilt
and I ran into a problem while testing.
This is the code that is generating the following error:
@HiltAndroidTest
@RunWith(CommonUiRunner::class)
class PhoneEditTextTest {
@Test
fun testThatNumberFormatted() {
val controller = Robolectric.buildActivity(AppCompatActivity::class.java)
val activity = controller.get()
val editText = PhoneEditText(activity)
activity.setContentView(editText)
controller.setup()
}
}
@Module
@InstallIn(ApplicationComponent::class)
object ApplicationModule {
@Provides
@Singleton
fun providePhoneNumberUtil(app: Application): PhoneNumberUtil = PhoneNumberUtil.createInstance(AssetsMetadataLoader(app.assets))
}
@Module
@InstallIn(ApplicationComponent::class)
object CountriesFeatureModule {
@Provides
@Singleton
fun providesApi(app: Application): CountriesFeatureApi = CountriesFeatureImpl(app.assets)
}
Returning:
APPLICATION and COUNTRIES-FEATURE modules contains in INJECTOR gradle-module.
Do you know how to fix this?