dagger-2 Questions

1

I am trying to generate Doka docs of my project. While generating I am getting an error like above. I have searched so many but could not able to get solution to this. I have gone through this link...
Vergeboard asked 28/2, 2019 at 6:43

2

Solved

How to pass parameter to viewmodel constructor using HiltViewModel library with jetpack compose My code: @HiltViewModel class GetPurchaseViewModel @Inject constructor(val id:Long) : ViewModel() { ...
Gandy asked 5/1, 2022 at 0:43

1

Let's assume I have a multimodule Jetpack Compose project with feature modules and I want to scope some object instances to features lifecycles. For example, I want to scope AuthRepo instance to Au...

5

hello my problem is the following, I have 2 fragments, one receives with SetFragmentResultListener and another sends with setFragmentResult The problem is that setFragmentResult does not work insid...
Accession asked 17/2, 2021 at 19:33

4

Solved

Is there any option to exclude Dagger2 classes from test coverage report in Android Studio

21

Solved

I am trying to implement MVVM pattern in my android app. I have read that ViewModels should contain no android specific code (to make testing easier), however I need to use context for various thin...
Beutler asked 21/7, 2018 at 0:29

1

Does anyone know anyway or library to instrument Dagger 2 and set traces to see how long each module takes to create on startup? We are trying to reduce cold startup time of an Android time and we...
Halves asked 12/2, 2019 at 12:14

4

Solved

I use Dagger2 with java and I got "Can not resolve symbol DaggerApplicationComponent error in my application." Seems there is something wrong with dependencies. Any help would be really appreciated...
Fagan asked 1/4, 2018 at 20:3

23

Solved

I'm using Dagger 2 and Kotlin for Android development. My project is also a multi-module project. My settings.gradle file is like this: include :app include :lib I'm also maintaining the lib mod...
Reuben asked 14/7, 2017 at 9:41

8

I added a new Retrofit interface to my project containing a couple of Endpoints annotated with the @GET and @HEADERS annotations, after Injecting said interface to a repository class using the @Inj...
Fakir asked 6/2, 2019 at 23:40

5

Solved

I have a class which i inject into a ViewModel + ViewModel factory, when initialise the view model in the onCreate method in activity, its says the value being passed through is not initialised. ...
Caning asked 24/7, 2019 at 12:14

7

Solved

I just started learning dagger2 and faced a strange issue that looks like a bug to me. Here's the module: @Module public class SimpleModule { @Provides Cooker providerCooker() { return new Coo...
Abbess asked 30/3, 2017 at 11:38

4

Solved

I have been recently trying to migrate my Android App from Dagger to Hilt. I would like to carry out the entire migration in phases and hence was trying to suppress the Hilt warning for not using @...
Isma asked 3/8, 2020 at 9:15

33

I'm new to using Kotlin and trying to set it up with Dagger2, I've seen some few examples but none of them seem to work for me. I keep getting this Error:Execution failed for task ':app:kaptDe...
Reiners asked 20/10, 2017 at 13:23

3

Solved

I am using Dagger2 for DI in my Android app, and using this code for injecting classes into my Activity is fine: @field:[Inject ApplicationContext] lateinit var context: Context but, lateinit mo...
Schaumberger asked 23/6, 2017 at 9:13

2

Any example of Dagger 2 static injections. I have already tried this : - class A{ @Inject static B b; static { getAppInstance().getComponent().inject(A.class); } static anyMethod(){ b.ano...
Tiffa asked 20/1, 2016 at 15:14

4

Solved

I use dagger2 demo by https://guides.codepath.com/android/Dependency-Injection-with-Dagger-2. I want to use cached and non_cached retrofit call. I create in NetModule.java @Provides @Named("cached...
Charitacharitable asked 13/7, 2017 at 12:10

4

I am working on implementing dagger 2 in my project. For this, i have written below lines of code: @Inject VideoControllerView mediaController; @Module public class PlayerModule { @Provides Vi...
Contortionist asked 5/6, 2017 at 6:48

7

Solved

I'm trying to inject the ViewModelFactory into my Activity, but it keeps throwing this same error: lateinit property viewModelFactory has not been initialized. I can't find what I may be doing wron...
Uzziel asked 27/5, 2018 at 17:21

1

Recently I upgrade Dagger 2.13 to 2.19, I have the below compile error at Proguard stage of this warning. Warning: com.mypackage.MyClass_Factory: can't find referenced method 'java.lang.Object inj...
Bebe asked 5/11, 2018 at 14:25

5

Solved

I'm using the new Dagger2 (ver 2.11) and I'm using the new features like AndroidInjector, and ContributesAndroidInjector. I have an activity subcomponent, @Module abstract class ActivityBuilder...
Cockatiel asked 7/10, 2017 at 9:42

3

Solved

I don't understand how to resolve this error. I got this error after trying to add fragments to my application and using Dagger for DI. Here is the error stack: error: [Dagger/IncompatiblyScoped...
Sagittal asked 20/12, 2018 at 21:31

9

Solved

I'm new with kotlin and Dagger. I have a little problem that I do not how to solve and I don't find a solution. So this is what I have: @Module class AppModule (app: Application) { private var a...
Bruis asked 19/12, 2015 at 22:31

2

Solved

According to the official integration guide, you need to add plugins { id 'kotlin-kapt' ... } and dependencies { implementation "com.google.dagger:hilt-android:{hilt_version}" kapt &...
Ruzich asked 3/5, 2022 at 20:11

2

I am trying to find a solution in how to define Hilt in a certain fragment related scenario. I have the following setup: Activity Parent Fragment 1 Child Fragment 1 Child Fragment 2 ... Child Fr...
Memoried asked 29/4, 2021 at 11:24

© 2022 - 2024 — McMap. All rights reserved.