Dagger-2 Questions
Ad
Is it still necessary to check an object for nullity if it is initialized using Dagger2?
I have an appmodule class where i have the following method that return a firebaseuser object that i want to be
Only one method can create a given subcomponent is created by plus()
I have a dagger subcomponent called usercomponent, created when a user signed in to the app, beneath that i have lists of
Dagger 2 Module Override in Subcomponent
I have app with subcomponents like this -------- applicationcomponent ------------ | |
Retaining Dagger 2 Subcomponent
Is it possible to retain a dagger 2 subcomponent for an activity through a configuration change? it seems like the only two possible solutions
@Component / @SubComponent
What's the difference between @component & @subcomponent in dagger2? when to use which one of those? can you provide examples / code
Dagger missing binding while adding AndroidInjector
I have the following problem: i started to study dagger 2 and trying to add injections to my app class. here's the code of my app class:
How to inject Network module like this?
I cannot think how to inject network module.i try and find many way to inject network module in dagger 2.but i cannot solve this.please help
Dagger2 create duplicate instance of interface in Module
I use dagger-android in my app with @contributesandroidinjector annotation. @module public
Dagger2 + ViewModel + Repository
I am new to dagger 2 and trying to implement it in kotlin. here i am trying to inject my repository object into viewmodel. i am successfully able
Is it okay to perform Dagger 2 injection inside a constructor of an Activity
The examples online regarding dagger2 for android always perform dependency injection inside the oncreate
Ad
Dagger2 dependency injection: How does it work in an android app?
I am trying to understand an
Shall we pass injected object in another class
I am just playing around the dagger2 for di implementation in android. my query is nothing about the problem that i am facing but just a
Dagger 2 acessing named dependencies in dependant module
I'm converting a legacy codebase to a multi feature module architecture, and i'm currently trying to sort out my dagger setup, but having some
WorkManager Java Android Dagger2
I need working workmanager in android app with java only (without kotlin!!!). in a project, we use just dagger2.8 (without android-dagger!) and i
Field not being injected with Dagger
In the following code, the field serviceutil is not being injected by dagger: appcontroller.kt class app : application() {
Dagger subcomponent with contributor
I'm having trouble injecting a fragment that i contribute via @contributesandroidinjector. i'm trying to build a hierarchy
How to @Inject into Kotlin Builder classes with Dagger
My current android project employs a number of kotlin data classes that employ builders to construct them. i wish to inject an instance
How to make MVRX viewmodels work with dagger2?
Edit adding the @viewmodelkey and making sure all the viewmodels have the @inject annotation did the trick
Dagger 2.10+: Inject dependency with activity context in Activities and Fragments
I have a class called alertmanager which requires activity instance to show toast and
Injecting Androidx Activity with Dagger 2
I am newbie in dependency injection with dagger in android i have this error unable to start activity componentinfo{mainactivity}:
Android auto inject dagger modules on each of i need that
After successful implementing dagger on project i have to specify dagger to each of class i want to use and inject modules, for example
Ad
How to inject Repository into ViewModel?
I am using dagger 2 and i have a dicomponent defined as follows: @singleton @component(modules = {
Update to Kotlin 1.3.30 breaks build with Dagger 2.21
Build error after update from kotling 1.3.21 to 1.3.30: appcomponent.java:16: error: [dagger/missingbinding]
Retrofit service is always null after adding Interceptor and injecting it using Dagger2
I have a relogin retrofit service like this interface tokenservice { @get("re-login") fun relogin():
Why do Dagger components have to declare their scope?
Why do i have to annotate a dagger component with the scopes it's going to use? why is it not enough to annotate the class itself?
Inject provider of ViewModelProvider.Factory into esspresso test
I have custom implementation of viewmodel.factory which is provided by lambda injected by dagger2
Android Jetpack Pagination using Fragment: Adapter not receiving callback
I am following the approach described in
Project structure with Dagger2
I'm learning how to use dagger2 and mvp, so i created project, contains one main activity with
error: Dagger/MissingBinding CryptoCurrencyViewModelFactory cannot be provided without an @Inject constructor or an @Provides-annotated method
I don't understand why am i getting this error:
Dagger Injection for dependent components
I am using dagger2 and i want to know if it is possible to use the new android injector for dependent components? i have
How to use Dagger2 library
In my application i want use dagger2 and for this i write below codes. my component class name is
How to access SharedPreferences in a ViewModel?
I am developing an android application using mvvm. i need to access sharedpreferences in a viewmodel, but i do not know
Ad
Dagger2: ViewModel cannot be provided without an @Provides-annotated method
I am following the architecture used by
Dagger 2 get old token when token is refreshed
I am having a problem with dagger 2. briefly, dagger 2 makes the injection in my fragment, and if the token is expired. tokenauthenticator asks
Not able to inject ViewModel with dagger2 android java
I am trying to inject viewmodel with help of a common viewmodelproviderfactory in dagger2.
Objects after inject is null
I am trying to inject objects that are singletons to 2 activity. my problem is, milk and coffee object after @inject are null into activity.
dagger 2.20 support for androidx package structure
Is dagger 2.20 working with the androidx package structure? i'm using kotlin. i get the error below during build. [kapt] an
Why AdnroidInjector.inject(fragment) uses deprecated android.support.v4.app.Fragment
I'm using dagger2 for di in android app, i want inject viewmodel in a fragment by androidinjector and have this two line
Where to inject AndroidInjection in custom/util classes using dagger2 in java android
I am using dagger 2. and injecting my dependency in activities and fragments which is working fine.
How does AssistedInject for Dagger 2 work?
The assitedinject library from square is actually an annotation
CustomScope may not reference bindings with different scopes
I am new to dagger, i have defined my application component like this @singleton @component(modules = {applicationmodule.class})
Dagger 2 subcomponent across Android modules
Recently i started to divide our application into smaller android modules, but i can't figure out how to structure dagger so it works for me.
AlertDialog with dagger - You must call removeView() on the child's parent first - Android
I am using from alertdialog with dagger like bellow: @module(includes = {
Ad
Unable to inject dependency in fragment using dagger2 in Java Android
I am able to inject dependency in activities and its working fine. but calling the same dependency in fragment is not taking access. this
Dagger with FragmentPagerAdapter - android
I am using from dagger in my viewpager like bellow. my viewpageradapter.java: public class
How to inject a ViewModel into BottomSheetDialogFragment with Dagger2?
I inject my dependencies in activities and fragments on the preferred way with androidinjection.inject(this). i have the recommended
Dagger 2 error: dependency “cannot be provided without an @Provides-annotated method"
I've started using dagger 2 with android injector and faced an issue i have 5 modules, that are composed into one component
Failed resolution of: Lcom/google/common/collect/ImmutableMap; at com.my.app.di.DaggerMyApplicationComponent.getMapOfClassOfAndProviderOfFactoryOf(
I am getting this issue after integrating dagger 2 to implement dependency injection of imagedownloader library while running the app.
How to perform a Dagger 2 Constructor, Method, Field Injection?
I'm practicing dagger 2 for a week now, i just want to know the difference of these injections(constructor,
Dagger 2 How to solve constructor dependency
I am an android developer and trying to learn dagger2. i have gone through some tutorials and got some basic understanding. i
Dagger2: how to inject retrofit module in presenter class
Dagger2 learning is still difficult and am trying to learn. have setup a project using new dagger android to avoid injecting inside activity
Dagger2 Injection Unit Tests is null
Hi i have used dagger for dependency injections of network module, applicationmodule, databasemodule, presenters and interactor in my app. i want
Proguard rule setup for mvvm
The code is working fine without proguard rule setup. but when i enabled proguard in release build, the project is build successfully. app is
Cannot find symbol class DataBindingComponent caused by java.util.NoSuchElementException
I have a project where i'm using dagger version 2.18 (implementation "com.google.dagger:dagger:2.18") in android studio
Ad
Make a class injectable and a singleton with Dagger annotation only
I know there are tutorials of how to define singleton with module. but my question is not really on that. i mean dagger also provides
Picasso not loading images with Dagger 2
I'm still learning dagger 2 and tried to create a simple app using it. i am having trouble making picasso work since i can't see any errors in the
Android build fails when using dagger 2.18 with kotlin kapt
I am attempting to include in my android project the dagger android processor version 2.18 with kotlin-kapt. i am also using the androidx package
Kotlin Android MVP + Dagger 2 lateinit property presenter has not been initialized
Trying to use dagger with kotlin on android. and got the exception: caused by: kotlin.uninitializedpropertyaccessexception:
What is the use case for @Binds vs @Provides annotation in Dagger2
I am not certain on the purpose for dagger2's @bind
Android. Could not instantiate Worker
I want to pre-populate my room database from the json file in the assets folder. i follow the
Dagger 2 - Constructor Injection - Non-Activity
Just started learning dagger 2 in order to solve a specific problem: im trying to follow an mvvm architecture and my application has a repository
I am facing Dagger implementation issue
i implemented complete dagger implementation like added component,provides,module and inject and at the end i face following
one object if injected into 2 subcomponents under same custom scope, every time new instance is created of that object
One object if injected into 2 subcomponents under same custom scope, every time new instance is created of that object. i want same instance to be
Dagger2 vs Application class in android
By this simple example public class myapp extends application { private static myapp app; private imagedownloadercomponent
How to add DI (Dagger 2) in Activity and its parent
I use dagger 2 in my android project and want to use the @inject in an activity and inside another activity which extends the first
Ad
Android: Dagger 2 interferes with Immutables?
Getting a really strange issue; hopefully you guys can help. i have been using
How does Dagger 2 dispose of injected fields when they are no longer needed?
I have a question about injecting multiple fragments into the activity's fields. currently i have such a set up (all fragments extend
error: [Dagger/MissingBinding] [dagger.android.AndroidInjector.inject(T)] Dagger
I wanna to make a simple project with one main activity and multiple fragments. here i have two fragments at one activity and i want to inject
Dagger2 Multibinding [dagger.android.AndroidInjector.inject(T)] Found a dependency cycle:
I am trying to replicate what viewmodelfactory does for my presenter classes, here is my dagger2 code public class app extends
error: cannot find symbol method inject(TestApplication)
I'm completely new in dagger 2. to commence working with it, i have written some codes. after building code i have encountered following
After the subscription is added to disposable in RxAndroid (Observable), the control flow ends without calling subscribe..!
I am trying to use mvp, rx and dagger 2 in android. the following is the code flow, localdatasource.java
Cannot Find Symbol @Generated Using Dagger 2 and Proguard in Library Module
I had to have my laptop imaged at work. now the project won't build. other developers can continue building at the same commit fine so it must be
ViewModel is recreated after rotation; if injected directly with dagger2
Possible duplicate of this i am exploring
Should I dispose disposables in a Singleton class ( Android RxJava 2 )
When i subscribe({}) to an observable in a singleton class, do i need to call .dispose() method at some point? and if
Dagger2 conversion to android.dagger
I studied some tutorials about new dagger.android approach but can't make it right. i built a simple tutorial with subcomponent builder but i
How to implement Dagger for worker classes in Dagger 2.16 ?('android.arch.work:work-runtime')
How to implement dagger for worker classes in dagger 2.16? public class syncworker extends worker { @inject
Ad
How can I create ViewModel and inject repository to it with dagger 2?
I try understanding viewmodel. i create viewmodel: public class usersviewmodel extends viewmodel { private final
Dagger2 issue with "cannot be provided without an @Provides-annotated method."
I'm trying to setup a new project with dagger2, i've used dagger2 before, but now i'm trying to set it up from scratch by myself. i'm getting the
Dagger code works, how to make that Toothpick code work the same way?
I am starting using toothpick and i need to migrage from dagger code to toothpick. well, i have next string at my project with dagger.
Dagger 2 - dependency is not singleton when using custom scope
I have custom scope: @scope @retention(retentionpolicy.runtime) public @interface peractivity { } and component
dagger2, how can i call @BindsInstance denoted method of SubComponent..?
Please help me! i have a trouble in use of dagger 2. i want to bind some dependency in runtime not in compile time inside
Dagger 2, Providing Application Context in Module
Im pretty new in android development and newer in di. i am using kotlin on a personal project where i am experimenting with dagger 2. i managed to
Dagger2 Component inject for multiple Activities
This seems very basic question for dagger2 users . i have recently started exploring it with retrofit. i have followed
UninitializedPropertyAccessException: lateinit property pref has not been initialized
I know a similar question has been answered
How to add Authorization header in retrofit call using Dagger 2
I have a working code example of token based api authentication(laravel passport), but it's without dagger 2. i want to move code from current
Default implementation using dagger if @Named not found
The problem i am facing is that i have a base class and multiple child class. for resolving the particular child class i am using @named
How to implement Dagger for worker classes?
Since the worker class is created by the framework (workermanager), how can we use @inject fields into
Ad
Android Dagger2 Shared Manager Class
I am using dagger2 for my android app, now i want to create a manager class which provide some function to other module so,
Override dependencies in Dagger Module
There's a base module with common dependencies: @module object commonactivitymodule { @jvmstatic @provides fun
Why is my field `null` after injection? How do I inject my object?
this is a canonical question because there are a lot of
Trying to understand MVVM sample posted by Google
Folks, i am trying to understand the code sample posted by google related to the android architecture. i am going through the
LiveData observeForever not working
I've a weatherrepository class which calls the weatherprovider class to start fetching the weather. after the weather is successfully
Realm access from incorrect thread in rx and dagger
I know this question asks a lot but i am confused by reading this question.in my project i am using dagger, rx and realm in mvp pattern.i have an
Moxy with dagger doesn't save view state after rotation
I'm using moxy and dagger 2 in my app. it looks like that dagger works well, but moxy doesn't restore view state after rotation, and i don't
Don't know how to inject adapter for a RecyclerView
I made a simple project for learning dagger. the app is fetching a list of properties (vacation rentals) from internet and displays them on a
In Dagger 2.15,Should I need to add inject line on every Activity?
I am using dagger 2.15 with kotlin. should i need to add inject line on every activity? is it dagger official document updated for using latest
Dagger retrofit cannot be provided
Admiteddly,dagger is tough and i am trying to inject retrofit. i injected context and sharedpreferences and it works fine.but retrofit broke it
Android Dagger 2.14 setup
I am trying to figure out how to setup android project with dagger 2, but i am doing something wrong. dagger 2 and android dependancy injection is
Ad
How to inject into dynamically created use cases (android, clean architecture, dagger2)
I'm creating an android app and want to comply to clean architecture. for example, i have an activity which has a presenter which creates use
Singleton object becomes null after app is resumed
For my android project, i need global singleton cache object to access data about a user through the app. a problem occurs when an app
Ad
Blog Categories
Ad