The application does not implement dagger.android.HasDispatchingActivityInjector

I have a subclass of the application that I am compatible with HasDispatchingActivityInjector, but when I try to start my application, it will break, saying:

Unable to start activity ComponentInfo{com.test.testing/com.test.testing.ui.main.MainActivity}: java.lang.RuntimeException: android.app.Application does not implement dagger.android.HasDispatchingActivityInjector 

This is a subclass of the application:

 class MyApplication : Application(), HasDispatchingActivityInjector { @Inject lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Activity> override fun onCreate() { super.onCreate() DaggerAppComponent.create().inject(this) } override fun activityInjector(): DispatchingAndroidInjector<Activity> { return dispatchingAndroidInjector } 

Has anyone else experienced this error before?

thanks

+14
source share
2 answers

This happened because I did not add the android key: name with the value of my application subclass to the manifest file.

+52
source

Add android:name=".MyApplication" to your manifest under the application tag. Change "MyApplication" to the class name of your application

0
source

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


All Articles