Category : dagger-hilt

Can someone please help with this Hilt Dependency injection problem? Code is available here:: https://gist.github.com/nyxee/bfb2fd3b2a29d886479f5bc54d836e36 The error message I get is: error: cannot find symbol private final Provider<Class<T>> clazz; class ClubsViewModel<T> @ViewModelInject constructor(clazz: Class<T>) : BaseViewModel<T>(clazz) { listenToFireStoreCollection("Clubs", _mClubs) … } class BViewModel<T> @ViewModelInject constructor(clazz: Class<T>) : BaseViewModel<T>(clazz) { private var _mBs = MutableLiveData<List<T>>() listenToFireStoreCollection("Bname", ..

Read more

I’m trying to use Dagger hilt in my project. I have an Activity that uses Databinding: @AndroidEntryPoint class MainActivity : AppCompatActivity(), SetGreeting { private lateinit var binding: ActivityMainBinding @Inject lateinit var fragmentFactory: FragmentsFactory override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = DataBindingUtil.setContentView(this, R.layout.activity_main) supportFragmentManager.fragmentFactory = fragmentFactory … } override fun greeting(msg: String) { binding.greeting.text = ..

Read more

Im working on trying to provide my API service into a FragmentModule but its not working the way I have setup my Dependency injection, Im receiving a MissingBiding Error even though I have include the corresponding modules into the FragmentModule. This is my setup: AppModule @Module @InstallIn(value = [SingletonComponent::class]) object AppModule { @Provides fun provideApplication(application: ..

Read more

I’m injecting with Dagger-Hilt a class with a dependency on @ActivityContext in a ViewModel, this module is installed in ActivityComponent and scoped to activity and it’s throwing me an error whenever I try to compile. For your information I have other modules with ActivityRetainedComponent and SingletonComponent injecting @ApplicationContext. Now I’m trying to figure out what ..

Read more

I’m trying to use Dagger Hilt in my project. so I add these lines of code as the official documentation says: first, in my build.gradle (app) plugins { id ‘com.android.application’ id ‘kotlin-android’ id ‘kotlin-kapt’ id ‘dagger.hilt.android.plugin’ } … dependencies { implementation ‘androidx.legacy:legacy-support-v4:1.0.0’ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation ‘androidx.core:core-ktx:1.3.2’ implementation ‘androidx.appcompat:appcompat:1.2.0’ implementation ‘com.google.android.material:material:1.3.0’ implementation ‘androidx.constraintlayout:constraintlayout:2.0.4’ testImplementation ‘junit:junit:4.13.2’ androidTestImplementation ..

Read more

I’m trying to setup a multi-module Android app using Hilt, but after setting up everything I get the following error: D:Projetoshistorico-de-notificacoesappbuildgeneratedsourcekaptdebugbrcomfirstsofthistoriconotificacoessrcNotificationHistoryApplication_HiltComponents.java:124: error: [Dagger/MissingBinding] br.com.firstsoft.historiconotificacoes.domain.src.repository.NotificationRepository cannot be provided without an @Provides-annotated method. public abstract static class SingletonC implements NotificationHistoryApplication_GeneratedInjector, ^ br.com.firstsoft.historiconotificacoes.domain.src.repository.NotificationRepository is injected at br.com.firstsoft.historiconotificacoes.domain.src.usecase.notification.GetRecentNotificationsUseCaseImpl(notificationRepository) br.com.firstsoft.historiconotificacoes.domain.src.usecase.notification.GetRecentNotificationsUseCaseImpl is injected at br.com.firstsoft.historiconotificacoes.domain.src.usecase.UseCaseModule.bindsGetRecentNotificationsUseCase(arg0) br.com.firstsoft.historiconotificacoes.domain.src.usecase.notification.GetRecentNotificationsUseCase is injected at br.com.firstsoft.historiconotificacoes.src.notifications.recent.RecentViewModel(getRecentNotificationsUseCase) br.com.firstsoft.historiconotificacoes.src.notifications.recent.RecentViewModel ..

Read more