I have a service and I'm using dagger2 v2.27, In the google play store consolo y have the following crash (I don't have this crash in Firebase console tho)
Caused by: java.lang.RuntimeException: at dagger.android.AndroidInjection.inject (AndroidInjection.java:124)
at app.ui.main.ServiceNotificationListener.onCreate (ServiceNotificationListener.java:34) at android.app.ActivityThread.handleCreateService (ActivityThread.java:3758)
I'm using a Service that extends Android NotificationListenerService , in onCreate I have the following
override fun onCreate() {
AndroidInjection.inject(this) // line 34
}
MainApplication:
class MainApplication : Application(), HasAndroidInjector {
override fun onCreate() {
super.onCreate()
DaggerAppComponent
.builder()
.application(this)
.build()
.inject(this)
}
}
In AndroidManifest.xml
<application
android:hardwareAccelerated = "true"
android:name=".ui.MainApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme.NoActionBar.NoStatusBar">
I can't reproduce the bug, I reaad about the application is null, but not sure how I can solve the issue for my service (relies on NotificationListener) Thanks a lot