I have a question about Android HIlt. I have an Android module which provides APIs so basically a bunch of interfaces. Like
interface Paying {
fun pay(amount: Double)
}
I have a separate module in which the implementation for above interface lies
class Purchase @Inject constructor() : Paying {
override fun pay(amount: Double) {
// Implementation logic here
}
}
The impl module has following binding between interface and implementation class
@InstallIn(SingletonComponent::class)
@Module
abstract class PayingModule {
@Binds
abstract fun bindPayingApi(impl: Purchase): Paying
}
Doing above I am getting the error
cannot be provided without an @Provides-annotated method
If I move the interface and implementation in the same module, then error resolves. Does anyone know how can I fix this.