Abhishek Sharma
05/30/2023, 7:21 PMinterface 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.Dhaval Gondaliya
06/01/2023, 5:15 AM@Binds
abstract fun bindPayingApi(impl: Purchase): Paying
Alvin Dizon
06/01/2023, 7:47 AMPurchase
with @Singleton
Abhishek Sharma
06/01/2023, 5:34 PMFunkyMuse
06/02/2023, 9:32 AM