e: [ksp] @Provides with scope: com.my.package.di.AppScope cannot be provided in an unscoped component
This message is confusing, because it's not clear which the unscoped component is. I only found out by trial and error that this provider method is triggering the error. Removing @AppScope from the provider method resolves the error, but it would result in bugs and is required to be a singleton. Changing it to the following will work:
The second error message is being triggered by a check in place making sure you don't declare conflicting scopes on the class and the class it's extending. Yeah I think it shouldn't fire if they are actually the same scope.
I have a component similar to this:
I meant to add a new provider from a feature module like this:
This fails with following error:
This message is confusing, because it's not clear which the unscoped component is. I only found out by trial and error that this provider method is triggering the error. Removing
@AppScope
from the provider method resolves the error, but it would result in bugs and is required to be a singleton. Changing it to the following will work:However, this creates a new error:
This error is surprising, because the scope is not applied twice. I needed to change my final component to this to resolve the problem:
This code finally runs, but I'm afraid that it will start failing again with another interface being added.
Is this an error on my end? How do I avoid this?