Category : dagger-2

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) } And ..

Read more

Android Studio says: DangerousMaterialsFirePermissionsPresenter cannot be provided without an @Provides-annotated method. But I have it in Module class: @Provides @DangerousMaterialsFireWorkScope public DangerousMaterialsFirePermissionsPresenter providesDangerousMaterialsFirePermissionsPresenter(DangerousMaterialsFirePermiissionsPresenterImpl presenter){ return presenter; } Why it says that? How to solve it? Source: Android..

Read more

in my project I am using Dagger2 to inject ViewModels into fragments. override val viewModel: AllStockListTabViewModel by viewModels ({this}, {viewModelFactory}) To briefly explain my situation, I have a fragment that uses fragment state adapter which contains two fragments. For convinience, I’ll call the parent fragment fragment A and child fragments in fragment state adapter fragment ..

Read more

in my project I am using Dagger2 to inject ViewModels into fragments. override val viewModel: AllStockListTabViewModel by viewModels ({this}, {viewModelFactory}) To briefly explain my situation, I have a fragment that uses fragment state adapter which contains two fragments. For convinience, I’ll call the parent fragment fragment A and child fragments in fragment state adapter fragment ..

Read more

Getting this error on Android 12 only when trying to access the Dao for the first time in the app. Works perfectly fine in Android versions below. Using the below config //Room implementation "androidx.room:room-runtime:2.3.0" implementation "androidx.room:room-rxjava2:2.3.0" kapt "androidx.room:room-compiler:2.3.0" //dagger2 def daggerVersion = ‘2.40.1’ implementation "com.google.dagger:dagger:${daggerVersion}" implementation "com.google.dagger:dagger-android:${daggerVersion}" implementation "com.google.dagger:dagger-android-support:${daggerVersion}" kapt("com.google.dagger:dagger-compiler:${daggerVersion}") kapt("com.google.dagger:dagger-android-processor:${daggerVersion}") Error says: file is ..

Read more

My Application class is developed using Kotlin (I use Dagger2). In a class written in Java, I need to pass Context, but I get a nullpointerexception. How can I get Context? My Application class: class App : DaggerApplication() { override fun applicationInjector(): AndroidInjector<out DaggerApplication> { return DaggerAppComponent.factory().create(this) } } My Java Method: public class NotificationUtil ..

Read more

I have a module annotated in the following way: @AssistedModule @Module includes = [MyModule.Bindings::class, AssistedInject_MyModule::class] class MyModule { ///some methods annotated with @Provides and Bindings } Nothing about the code has changed. The app successfully compiles and builds on AGP 4.2 and Gradle 6.7.1 (Gradle is using Java 8). I went through the steps of ..

Read more