Dagger2 dagger.android. * Classes do not exist

I am adding Dagger2 to my Android app following the instructions from the white papers . I used to use Dagger and Dagger2, it seems that Google has updated the Android version using the following quote:

The classes in dagger.android offer one approach to simplify this pattern.

...

Then make your application an implementation of HasDispatchingActivityInjector and @Inject DispatchingAndroidInjector to return from the activityInjector () method:

It looks awesome, but I canโ€™t find the dagger.android package anywhere and find nothing when I look at the repository, HasDispatchingActivityInjector doesn't show any hits on Google at all. Where are these classes described in the docs?

I can find all the other Dagger2 classes in order (Module, etc.) so that the libraries are there.

My dagger dependencies on 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' 
+6
source share
2 answers

The code is listed in the Google repository / Github dagger under the java/dagger/android subtree committed four days ago (February 13, 2017 3:58 pm PST). This includes HasDispatchingActivityInjector .

Your gradle file is correct: Android Dagger extensions are available through the neighboring dagger-android package, and not through the main dagger package. See Maven Dagger packages for more details.

EDIT: As of yesterday, dagger.android Android helpers are released in version 2.10-rc1

+6
source

dagger.android classes were added version 2.10 release notes here .

Create your code, you need to update your dagger dependencies on build.gradle :

 compile 'com.google.dagger:dagger:2.10' compile 'com.google.dagger:dagger-android:2.10' annotationProcessor 'com.google.dagger:dagger-compiler:2.10' 
+6
source

Source: https://habr.com/ru/post/1015072/


All Articles