I'm wondering how to properly scope dependencies with Koin library.
Since Google recommends a single Activity architecture the AndroidX Navigation lib has become a key library to facilitate this by easily swapping Fragments.
A typical modern Android…
I'm learning Koin's Scope from https://github.com/InsertKoinIO/koin/blob/master/koin-projects/docs/reference/koin-android/scope.md
If I have a Koin module as below
val myModule =
module {
scope { scoped { Presenter() } }
…
Long story short, I am facing strange app crashes with NoBeanDefFoundException, but it happens randomly. For some devices it works as expected and for others just crashes.
I have a multi module project with lots of koin modules and it worked as…
So scoping with Koin DI seem to throw a weird exception when KoinApplication::checkModules() method is called within a unit test. Here is the full code:
import org.koin.core.KoinApplication
import org.koin.core.component.KoinComponent
import…
I am trying to upgrade my koin usage from 2.1.6 -> 3.0.2 and am having troubles with the scoped injections.
I have MVPs where the Activity/Fragment is the view and i want to inject the view in the presenter.
so i have
module {
…
Could not GET 'https://dl.bintray.com/ekito/koin/org/koin/koin-core/3.0.1/koin-core-3.0.1.pom'. Received status code 403 from server: Forbidden
Disable Gradle 'offline mode' and sync project
Adding this line show error
maven(url =…
need little bit clarity on one thing, right now working on a flow where I've two view model and one is dependent on other , to handle that thing I tried injecting both view models in my Base Activity the problem I faced, with this approach. Every…
koin works fine with most of my devices of same model but it cause crash in single device with the IllegalStateException,
i have give android context as applicationContext but still it is cause crash.
Before Updating to Latest Version it was…
I have a class TestClass and I want to share its instance between child fragment with using koin scope of parent fragment.
Is it possible to do?
Thanks.
I try:
class TestClass {
fun close() { .... }
}
class ParentFragment(): Fragment { }
val…
I must use Koin to construct a custom scope using "Android Service" in my Android app module. I read other blogs and the Koin documentation; a few of them are below.
Understanding Android Scopes with Koin
Android Sample project
Koin Scope…
I'm trying to solve this issue: I'm receiving a crash whenever i try to click on a push notification in certain fragment, that would redirect me to another fragment in the app.
I defined my module like this:
scope(named()) {
…
I'm maintaining a large app (mostly) using a "one feature one activity"-architecture.
Now i'd like to scope a usecase, so it lives as long as the activity, something like this:
// koin module
scope {
viewModel {…
I have this particular test case that I don't know how to solve with Koin.
I have a FooClass tied to the MainActivity lifecycle, and I have other fragments that also need to use FooClass. Those fragments need the FooClass to be inject in the…
I am using the latest Koin version 3.1.2. I have a basic Fragment that accepts a String parameter to it's constructor.
My Koin setup is as follows:
Activity:
override val scope: Scope by activityScope()
private val fragment by inject {
…
Using Koin library I'm trying to achive this behaviour:
val scopeA = getScope(ID)
val scopeB = scopeA.clone()
Short speaking, clone() should copy all instances from one scope to another.
So in this case I can modify scopeB without modifying the…