I have a question about dagger. I have an Android ...
# android
a
I have a question about dagger. I have an Android module which provides APIs so basically a bunch of interfaces. Like
Copy code
interface Paying {
    fun pay(amount: Double)
}
I have a separate module in which the implementation for above interface lies
Copy code
class Purchase @Inject constructor() : Paying {
    override fun pay(amount: Double) {
        // Implementation logic here
    }
}
The impl module has following binding between interface and implementation class
Copy code
@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.
not kotlin but kotlin colored 4
My apologies if this was not suppoe to be posted here.
p
You can try in #dagger
👍 1
s
You should annotate the function using provides annotation