Questions tagged [dagger-hilt]

Hilt is a Dagger2-based dependency injection library for Android.

The goals of Hilt are:

  • To simplify Dagger-related infrastructure for Android apps.
  • To create a standard set of components and scopes to ease setup, readability/understanding, and code sharing between apps.
  • To provide an easy way to provision different bindings to various build types (e.g. testing, debug, or release).
1333 questions
0
votes
1 answer

UninitializedPropertyAccessException when using Hilt

Im getting lateinit error but I dont see the issue kotlin.UninitializedPropertyAccessException: lateinit property soldatDatabase has not been initialized at pl.rybson.soldatlobby.di.RoomModule.provideServersDao(RoomModule.kt:37) at…
edwinnurek
  • 135
  • 2
  • 12
0
votes
1 answer

DaggerApp_HiltComponents_ApplicationC.java compile time error - cannot find symbol

I'm trying to integrate Hilt into my project, but I'm not able to get pass the initial configuration. So far I added the plugin and the dependencies, following step by step the official documentation. As soon as I tag the Application class with…
user14053787
0
votes
1 answer

Hilt dependency injection, glide module inside a provided module

I'm new to hilt and dagger and I don't know if what I'm doing is wrong or if its not working for a different reason so please bear with me. I want to inject a class that depends on another class into a view holder class. The view holder extends…
martinseal1987
  • 1,862
  • 8
  • 44
  • 77
0
votes
1 answer

Creating subcomponents with Dagger Hilt

Based on this tutorial to add subcomponents using Dagger Hilt requires @Singleton class UserManager @Inject constructor( // Since UserManager will be in charge of managing the UserComponent's // lifecycle, it needs to know how to create…
Thracian
  • 43,021
  • 16
  • 133
  • 222
0
votes
1 answer

Recyclerview does not refresh MVVM

I am new using MVVM and Kotlin. I decided to use them in a new project, I do not know what is wrong. I am using Hilt MVVM and ViewModel etc. hopefully you can help me This is the Fragment who request the data from the db, when somebody presses the…
V1t0r14n0
  • 111
  • 5
0
votes
1 answer

error: [Dagger/MissingBinding] @com.zhixin.wedeep.common.di.LoginApi okhttp3.OkHttpClient cannot be provided without an @Provides-annotated method

When i executed my test code with hilt, i got above error. Which is quite werid, because everything run well in my app. The following is my test code. @HiltAndroidTest @RunWith(AndroidJUnit4::class) @LargeTest class TestHomePageFragment { …
Cyrus
  • 8,995
  • 9
  • 31
  • 58
0
votes
1 answer

LiveData returns wrong Object

I added Hilt to my project and now LiveData returns wrong Object type. Maybe I made some wrong changes in my code. getAllCurrencies returns LiveData> but it should LiveData> ViewModel: class SplashScreenViewModel…
edwinnurek
  • 135
  • 2
  • 12
0
votes
1 answer

How do I use HiltViewModelFactory in non-Android classes?

How can one go about injecting HiltViewModelFactory into non-Android components like Conductor's Controller.. etc. Currently I have this code but it doesn't work, saying HiltViewModelFactory cannot be provided. @EntryPoint …
Vincent Paing
  • 2,308
  • 3
  • 17
  • 29
0
votes
1 answer

Hilt dependencies not provided in tests

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()…
0
votes
1 answer

"Cannot resolve method" @AuthInterceptorOkHttpClient

I am trying to integrate dagger-hilt on my project on android. I have implemented the libraries and steps in the link below. However, I cannot access the @AuthInterceptorOkHttpClient annotation. I get the error "Cannot resolve method". For this I…
Ümit Bülbül
  • 512
  • 2
  • 15
-1
votes
1 answer

cant recieve data from the api retrofit

As an aspiring Android developer, I successfully created a simple MVVM dictionary app, leveraging the power of popular tools such as Retrofit for API calls, Dagger Hilt for dependency injection, and Jetpack Compose for crafting an intuitive UI.…
-1
votes
1 answer

Hilt NullPointerException onAttach by Preconditions.checkNotNull on Fragment

I have fragment which extend Fragment and I' m getting hilt error java.lang.NullPointerException at dagger.hilt.internal.Preconditions.checkNotNull(Preconditions.java:34) at…
Slava
  • 443
  • 4
  • 12
-1
votes
1 answer

Unable to build when Added new Activity in project having Hilt - Android

In my project, using dagger-Hilt just by adding a new activity, it shows an error :app:kaptDebugKotlin [Hilt] java.lang.reflect.InvocationTargetException (no error message) but before adding a new activity, the whole project works…
Sidharth
  • 79
  • 10
-1
votes
2 answers

Error: Could not resolve all artifacts for configuration ':classpath'. Cannot resolve external dependency X because no repositories are defined

I want to add dagger hilt dependency in my project but compiler shows this message. This is error message Could not resolve all artifacts for configuration ':classpath'. > Cannot resolve external dependency…
hemant
  • 173
  • 2
  • 9
-1
votes
1 answer

Package folder named 'case' in Android Studio causes hilt error

I found a very strange behavior in Android Studio. When I try to create a package case then Android Studio marks the folder as folder and not as a package: This is not just a UI problem. When I place a class inside the case folder and I want to use…
GenError
  • 885
  • 9
  • 25
1 2 3
88
89