I made a sample application and did all steps from the manual. But something is not working.
Error:(11, 8) error: [dagger.android.AndroidInjector.inject(T)] java.util.Map<java.lang.Class<? extends android.support.v4.app.Fragment>,javax.inject.Provider<dagger.android.AndroidInjector.Factory<? extends android.support.v4.app.Fragment>>> cannot be provided without an @Provides-annotated method.
java.util.Map<java.lang.Class<? extends android.support.v4.app.Fragment>,javax.inject.Provider<dagger.android.AndroidInjector.Factory<? extends android.support.v4.app.Fragment>>> is injected at
dagger.android.DispatchingAndroidInjector.<init>(injectorFactories)
dagger.android.DispatchingAndroidInjector<android.support.v4.app.Fragment> is injected at
dagger.android.support.DaggerApplication.supportFragmentInjector
com.*.*.presentation.component.Application is injected at
dagger.android.AndroidInjector.inject(arg0)
My activity inherits DaggerAppCompatActivity, and my application is here:
public class Application
extends DaggerApplication {
@Inject
DispatchingAndroidInjector<Application> injector;
@Override
public void onCreate() {
super.onCreate();
DaggerApplicationComponent.create()
.inject(this);
}
@Override
protected AndroidInjector<? extends DaggerApplication> applicationInjector() {
return injector;
}
}
Check here: DaggerApplication.java.
Either extend that, the support variant or make your own. With your current setup, the error is saying you need to add a support.Fragment DispatchingAndroidInjector in your application.
@JonathanMerritt Thats what I do. I extend Support Dagger Application class. And I have no any fragments. So I can't understand why I get this error.
I'm at a loss then. Sorry. Hopefully a smarter someone can help you further.
You need to include AndroidSupportInjectionModule. That protects you in
case you ever add a support fragment in the future.
On Wed, Jun 21, 2017, 8:29 AM Artem Shalaev notifications@github.com
wrote:
@JonathanMerritt https://github.com/jonathanmerritt Thats what I do. I
extend Support Dagger Application class. And I have no any fragments. So I
can't understand why I get this error.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/google/dagger/issues/783#issuecomment-310063405, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAwY3Q36JYrs_u1dlv_EJ7YKV1ZGATiWks5sGQyagaJpZM4OA2Tq
.
@ronshapiro Omg, works like a charm! Thank you!
I don't think this ticket should be closed. The additional module is not documented. It seems like it should not be required either. Maybe the docs should be updated here or the requirement should be removed.
I ran into this problem some time after getting the basic sample with empty modules working. It happened while trying to provide additional dependencies from my Activity module. So the AndroidSupportInjectionModule is not required, then it is required later at a seemingly arbitrary point.
You need to include AndroidSupportInjectionModule. That protects you in case you ever add a support fragment in the future.
Fyi the above class is deprecated. Please use: AndroidInjectionModule
i had this error cause different dagger dependencies version
i change this
implementation 'com.google.dagger:dagger:2.24'
annotationProcessor 'com.google.dagger:dagger-compiler:2.24'
implementation 'com.google.dagger:dagger-android-support:2.16'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.16'
to
implementation 'com.google.dagger:dagger:2.16'
annotationProcessor 'com.google.dagger:dagger-compiler:2.16'
implementation 'com.google.dagger:dagger-android-support:2.16'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.16'
@marjandn lowering version from 2.24 to 2.16 doesn't work. Is v2.16 compatible with androidx ?
@ShankyPatel
I have another project with kotlin dsl and dagger
And i had this issue with the dagger 2.16!
So I changed all the dependencies to 2.24 and worked well.
note that should change some code and classes in dagger 2.24
Most helpful comment
You need to include AndroidSupportInjectionModule. That protects you in
case you ever add a support fragment in the future.
On Wed, Jun 21, 2017, 8:29 AM Artem Shalaev notifications@github.com
wrote: