Since Kodein version 6.x we get this error when bi...
# kodein
s
Since Kodein version 6.x we get this error when bindings are examined:
Copy code
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wecenergygroup.wps.debug/com.wec.weenergies.screens.landing.LandingActivity}: org.kodein.di.Kodein$NotFoundException: 3 bindings found that match bind<Context>() with ?<LandingActivity>().? { ? }:
            module Context {
                bind<Context>() with singleton { Application }
            }
            module WeEnergiesApplication {
                bind<WeEnergiesApplication>() with singleton { WeEnergiesApplication }
            }
            module ⁣androidModule {
                bind<Application>() with provider { Application }
            }
The first two are under our app’s control, the last one is from Kodein’s
androidModule
. What would be the ‘best’ way to solve this ambiguity? Using ‘sub-type’ bindings or is there a less verbose way?
s
I would use tags
s
Thank you! Still, using tags is easy to forget where
instance()
is being called. Is there way to bind to a concrete type and not to a sub-type?
s
You can bind any type, including concrete types.
s
@salomonbrys Thank you! The stack-trace didn’t happen in version 5.x but started happening in 6.x. We are wondering why and what would be the best/easiest way to fix it.