evilthreads669966 / BootLaces

A Kotlin work manager library for Android with progress notifications and Hilt support.
Apache License 2.0
34 stars 4 forks source link

Unable to inject a constructorer injected dep in LifecycleObserver with @ActivityContext binding #233

Open evilthreads669966 opened 3 years ago

evilthreads669966 commented 3 years ago

It's complaining about ReschedulingReceiver matching the same key.

C:\Users\evilt\AndroidStudioProjects\EvilScreenNew\app\build\generated\source\kapt\debug\com\evilthreads\App_HiltComponents.java:141: error: [Dagger/MissingBinding] @dagger.hilt.android.qualifiers.ActivityContext android.content.Context cannot be provided without an @Provides-annotated method.
  public abstract static class SingletonC implements ReschedulingReceiver_GeneratedInjector,
                         ^
  A binding with matching key exists in component: com.evilthreads.App_HiltComponents.ActivityC
      @dagger.hilt.android.qualifiers.ActivityContext android.content.Context is injected at
          com.evilthreads.LockObserver(activityContext, �)
      com.evilthreads.LockObserver is injected at
          com.evilthreads.lock.ui.LockActivity.lockObserver
      com.evilthreads.lock.ui.LockActivity is injected at
          com.evilthreads.lock.ui.LockActivity_GeneratedInjector.injectLockActivity(com.evilthreads.lock.ui.LockActivity) [com.evilthreads.App_HiltComponents.SingletonC ? com.evilthreads.App_HiltComponents.ActivityRetainedC ? com.evilthreads.App_HiltComponents.ActivityC]
evilthreads669966 commented 3 years ago

A performance costing workaround is @ApplicationContext

evilthreads669966 commented 3 years ago

Nevermind. I think I tried to inject activity context into a singleton that isn't activity scoped

evilthreads669966 commented 3 years ago

So since the updated HIlt. I need to take ReschedulerReceiver out of SingletonComponent but I haven't seen the code yet as it looks kike the newest version doesn't use ApplicationComponent any longer