-1

I would like to know

why we need to add

injects = { 
            FirstFragment.class, 
            DownloadManager.class,
            BookRefreshTask.class 
        } 

in application class or module class.

as we injecting the fragment and activity using graph.inject(this) method

gandhi
  • 122
  • 6
  • In short, Dagger needs to know where to start injecting. The classes in that t=list are things that are themselves _not_ injected, but which have injected members. – Karakuri Dec 02 '14 at 05:20
  • @Karakuri start injecting is known from where we write graph add method which is in application class. but i want to know what is the use of injects {} annotation i mentioned in my question – gandhi Dec 02 '14 at 05:26

1 Answers1

0

As I undestand this.

Dagger consists of two modules:

  • runtime module (which uses @Inject annotations to satisfy dependencies at runtime)
  • compile time module (which uses "injects = {A1.class, A2.class}" to check code for unsatisfied dependencies).

So this is a price we need to pay for compile time errors handling.

user2041064
  • 131
  • 7