I'm adding Dagger2 to my Android app following the instructions from the official docs. I've used Dagger and Dagger2 before, it seems like Google has revamped the implementation for Android as of the following quote;
The classes in dagger.android offer one approach to simplify this pattern.
...
Next, make your Application implement HasDispatchingActivityInjector and @Inject a DispatchingAndroidInjector to return from the activityInjector() method:
It looks awesome, but I can't find the package dagger.android
anywhere, nor do I find anything when I look through the repository, HasDispatchingActivityInjector
gives no hits on Google at all. Where are these classes described in the docs?
I can find all the other Dagger2 classes alright (Module etc.) so the libs are there.
My dagger dependencies from build.gradle
:
compile 'com.google.dagger:dagger:2.9'
compile 'com.google.dagger:dagger-android:2.9'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
The code is listed in the google/dagger Github repository, under the java/dagger/android
subtree, committed four days ago (Feb 13, 2017 3:58PM PST). This includes HasDispatchingActivityInjector.
Your gradle file is correct: Dagger's Android extensions are available through an adjacent dagger-android
package, not through the main dagger
package. See Maven's Dagger packages for more details.
EDIT: As of yesterday the dagger.android
Android helpers are released in version 2.10-rc1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With