Questions tagged [dagger]

Dagger is a dependency injection library for Java and Android.

Dagger, by Square, is a fast dependency injection library for Java and Android. It is compatible with JSR 330. Dagger intentionally leaves out some features and imposes some restrictions in order to attain rapid startup times by eliminating slow runtime reflection, especially on Android.

Dagger 2 is a fork maintained by Google which eliminates reflection in the graph generation phase.

For instance, Dagger does not support the following:

  1. Method Injections.
  2. private and final field injections.

Useful Links

1471 questions
0
votes
4 answers

dagger 2 not generating component class

I tried to use dagger 2 for the first time in one of my apps. Im getting error at dagger component class as the class did not get generated. please help me to get it work. Link to my app https://github.com/kantigaricharan/Zolo This the Error …
charan reddy
  • 38
  • 1
  • 8
0
votes
2 answers

What is the difference between Binding Views and Injecting Views?

I'm learning ButterKnife and dagger and came to know that Butterknife only helps to avoid boilerplate codes(Binding views) and it doesn't really inject. And dagger compliment Butterknife in this case as it injects code. Now what is the difference…
Abhishek Kumar
  • 4,532
  • 5
  • 31
  • 53
0
votes
1 answer

Exclude generated by dagger2 class from apk

I have abstract FirstClass, and his child class SecondClass In second class I have dagger inject: component.inject(this); But _MembersInjector generate for this two classes — FirstClass_MembersInjector and SecondClass_MembersInjector How can I…
winston
  • 875
  • 1
  • 8
  • 15
0
votes
0 answers

DaggerInjector not found in Android 3.0 with gradle:3.0.0-alpha9

In my App.class's onCreate() I instantiate my Injector like this: injector = DaggerInjector .builder() .appModule(new AppModule(this)) .build(); In the officiel Android Studio Release of 2.3 everything works as…
user5366495
0
votes
1 answer

Dagger2 Subcomponent error - where have to annotate method ArrayAdapter

I use dagger2 demo by https://guides.codepath.com/android/Dependency-Injection-with-Dagger-2. I want to use subcomponent for ArrayAdapter injection in DemoDaggerSubActivity.java. my Application.java @Override public void onCreate() { …
eurosecom
  • 2,932
  • 4
  • 24
  • 38
0
votes
2 answers

Android Dagger-2 how to provide the dependency for method parameters

I have a module FragmentModule @Module public class FragmentModule { @Provides public static PickerDashboardFragment providesPickerDashboard(int status, String name, Object someComplexObject) { PickerDashboardFragment fragment =…
eC Droid
  • 651
  • 2
  • 9
  • 26
0
votes
1 answer

How to inject idemId to presenter with Dagger 2? dagger.android

I want to pass clicked item id to detail presenter directly. I have a public property on my detail activity so I tried to provide that to my presenter. Here is my code; @Module public class MovieDetailActivityModule { @Provides Long…
Efe Budak
  • 659
  • 5
  • 27
0
votes
0 answers

Dagger2 getting NoClassDefFoundError error for NetworkModule_LoggingInterceptorFactory

when i try to test my application on more android device, i get this error: java.lang.NoClassDefFoundError: com.myapp.androidapp.Dagger.Modules.NetworkModule_LoggingInterceptorFactory i search more problems about Dagger, but i can't find whats this…
tux-world
  • 2,680
  • 6
  • 24
  • 55
0
votes
1 answer

How to build dagger itself

The dagger project uses bazel.build system to build. I have installed bazel on Fedora, it runs and builds the project but apparently dagger has Java 1.8 code, and bazel targets java 7. There is a build_def.bzl file and java target version is defined…
hkoosha
  • 1,136
  • 2
  • 15
  • 30
0
votes
0 answers

Android Dagger 1.0.1: Incompatible types: Cannot convert integer[] to int[]

I am using Dagger 1.0.1 in one of my projects. I was recently using 1.2.2 and everything compiled and ran fine. I wanted to introduce ProGuard into the project and was having a lot of trouble, and it sounded promising that downgrading to 1.0.1 would…
0
votes
1 answer

googleSample mvp-todo-dagger2

I work with googleSample mvp-todo-dagger2 Click here; In my App One Activity has two Fragment,How to Inject two PresenterModule to one Activity?
0
votes
1 answer

Dagger2 component is not created

Here is the code.... build.gradle // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath…
Pavandroid
  • 1,586
  • 2
  • 15
  • 30
0
votes
1 answer

Android injecting class return null

I'm using JobQueue library and i can successful inject some class such as GithubService to that for example: public interface GithubService { @GET("repositories") Call> getAllRepositories(); } now i'm trying to inject…
tux-world
  • 2,680
  • 6
  • 24
  • 55
0
votes
1 answer

GCM to FCM migrate. Firebase not working. Unregistered registration token

I try to migrate from GCM to FCM. I read this guide. I clone code from firebase quikstart app everything works great. But if I try to implement in my app I have a ploblem. I try to send several messages from firebase console and status some of them…
0
votes
1 answer

Dagger 2 updating to 2.9. Building error

I try to update my dagger version from 2.0.2 to 2.9 ... compile 'com.google.dagger:dagger:2.9' apt 'com.google.dagger:dagger-compiler:2.9' ... Now my project not builds. I have lot of "error: cannot find symbol MyClass_" and "warning: unknown enum…
Viktor Burmaka
  • 211
  • 4
  • 8