You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue was resolved for me in #224 with the introduction of KoinContext. Since it seems that has been removed in 2.0.0-rc-2 I've updated my SDK module to use the scope API.
I'm now getting the error message Already existing definition or try to override an existing one: [type:Scope,class:'okhttp3.OkHttpClient'] when trying to loadKoinModules(...) in my SDK client. I was expecting there to be no conflict since the OkHttpClient in my SDK module is scoped.
Is there something I'm missing with the new scope API? Is there a way for me to load in the SDK module without raising a conflict? It would be great if I could start another Koin instance that is completely separate from my app's instance so my SDK users would never have to run into this issue.
Here is a snippet of my app's module:
module {
single { createOkHttpClient(androidContext(), get(), get()) }
}
I was able to resolve this myself 10 mins after posting this 🤦♂️No need for the scope API it seems.
Here is how I separated the Koin instances incase anyone else is confused:
) : KoinComponent {
private val koinApplication = KoinApplication.create().apply {
properties(...)
modules(...)
}
override fun getKoin(): Koin = koinApplication.koin
val userDataSource: UserDataSource by inject()
...
This issue was resolved for me in #224 with the introduction of KoinContext. Since it seems that has been removed in 2.0.0-rc-2 I've updated my SDK module to use the scope API.
I'm now getting the error message
Already existing definition or try to override an existing one: [type:Scope,class:'okhttp3.OkHttpClient']
when trying toloadKoinModules(...)
in my SDK client. I was expecting there to be no conflict since the OkHttpClient in my SDK module is scoped.Is there something I'm missing with the new scope API? Is there a way for me to load in the SDK module without raising a conflict? It would be great if I could start another Koin instance that is completely separate from my app's instance so my SDK users would never have to run into this issue.
Here is a snippet of my app's module:
Here is a snippet of my SDK's module:
Here is a snippet of my KoinComponent:
The text was updated successfully, but these errors were encountered: