I have an issue with Anvil that drives me crazy. I have two classes defined in the same library module
@ContributesBinding(scope = Singleton::class)
class ConnectionStatusProviderImpl @Inject constructor(
application: Application
) : ConnectionStatusProvider {
and
@ContributesBinding(scope = Singleton::class)
class AndroidResourceUtil @Inject constructor(
@AppContext context: Context
) : ResourceUtil {
which should add a binding to the ApplicationComponent (in the app module)
@Singleton
@MergeComponent(scope = Singleton::class)
interface ApplicationComponent {
This works as expected for
ConnectionStatusProviderImpl
but not for
AndroidResourceUtil
. I get the dreaded
> [Dagger/MissingBinding] xyz.ResourceUtil cannot be provided
If I copy the class into the main module, it works perfectly but obviously we don't want to move dependencies to the app module just to make it work with Anvil + Dagger. What am I overlooking?
``````