0

I've been trying to setup activity graphs for my Android application with Dagger (v1.1.0). Although it compiles fine, I get this error shown below (full trace here):

No injectable members on com.f2prateek.couchpotato.ui.ActivityActionBarController. Do you want to add an injectable constructor? required by class com.f2prateek.couchpotato.ui.fragments.DetailedMovieGridFragment

I'll do my best to highlight the important sections, but in case I miss something, my full project is on GitHub. Just run ./gradlew clean assemble to build the apk.

My ActivityModule has the provider method that Dagger can't seem to find.

@Provides @Singleton ActivityActionBarController provideActionBarTitleController() {
    return new ActivityActionBarController(activity);
}

This module is definitely being added to the applicationGraph (which then is saved as the activityGraph) in my BaseActivity, and the BaseFragment is injecting itself into the activityGraph.

f2prateek
  • 2,034
  • 2
  • 20
  • 26

1 Answers1

0

Dagger uses an annotation processor to write it's code. If your class is not annotated, it can't find it. Make sure you add annotations to every class. E.g. if you want to inject a member, you must use @Inject. Try to make sure all classes you're injecting is in listed under @Module(inject=...). Try to ensure all classes are listed in the module class somewhere.

Alex Collins
  • 980
  • 11
  • 23
  • As far as I can see I've done all of those. The Activity is listed under the `injects` for the module (and it is able to get dependencies from the application graph just fine). The dependency has a provider method for it, the activity is getting added to the activity graph and the dependency has the @Inject annotation in the activity. Anything else that I would be missing? – f2prateek Oct 28 '13 at 03:17