Questions tagged [android-koin]
16 questions
4
votes
1 answer
How to set half expanded height for bottomsheet using BottomSheetScaffold in compose?
I need to show my bottomsheet first in collapsed state. And on swipping bottomsheet up, it should first fix in half height of screen first. Again on swipping up , it should expand to max height of screen. Same during collapsing. First from max…

Heleena Joy
- 89
- 7
2
votes
1 answer
Koin, can't find a way to use lazyModule in my app
I've seen in the official Koin's doc that is possible to declare a module as lazy to avoid to be pre-allocated on app startup, but I'can't find a way to make it work.
In my gradle config file I have:
api…

TabascoLosco
- 145
- 7
1
vote
0 answers
How to create scope for parent fragment to use it in children
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…

Sabrak
- 21
- 3
1
vote
0 answers
Custom scope with koin and kotlin
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…

CLIFFORD P Y
- 16,974
- 6
- 30
- 45
0
votes
0 answers
Facing problem to use inject method of koin in java android
I ma trying to use koin dependency injection.
Implemented successfully but the problem is I am unable to reach Inject method as activity show error in that word. val favTemplateDao by inject()
what am I missing everything implemented as it has to…
0
votes
1 answer
Using Koin for Ktor-Client in Android: Missing type 'io.ktor.client.engine.HttpClientEngine'
I could use some help understanding why this module for a ktor client fails -
fun provideKtorClient() = HttpClient(OkHttp) {
install(ContentNegotiation) {
json()
}
}
val ktorModule = module {
single { provideKtorClient()…

Offbeat Upbeat
- 39
- 5
0
votes
1 answer
Error: Lorg/koin/android/ext/android/AndroidKoinScopeExtKt
**implementation 'io.insert-koin:koin-android:3.4.0'**
class SplashActivity: AppCompatActivity() {
private val viewModel: SplashViewModel by viewModel()
...
class MyApplication: Application() {
override fun onCreate() {
super.onCreate()
…

FlipNovid
- 1,191
- 3
- 12
- 20
0
votes
0 answers
MockKAgentException when testing Koin modules
I'm trying to test my koin modules following this koin documentation
import android.app.Application
import android.content.Context
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.lifecycle.SavedStateHandle
import…

Leonardo Sibela
- 1,613
- 1
- 18
- 39
0
votes
0 answers
Integrate Koin in AAR
I have an AAR project, and i'm trying to integrate Koin (my first Koin project).
I'm following Koin instruction for context isolation (https://insert-koin.io/docs/reference/koin-core/context-isolation/). and i will be glad to get some help.
I need…

Bruse
- 303
- 1
- 6
- 20
0
votes
0 answers
Android kotlin NoClassDefFoundError : JAXBException is firing while building the application?
While importing already existing code from Bitbucket, I am getting a NoClassDefFoundError as shown:
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at…

Priya R G
- 543
- 4
- 10
- 21
0
votes
0 answers
How to access inject class inside a ViewHolder using Koin
I have a injectable class like below
class MyClass(private val injectClass: InjectClass) {
fun somFunction() {
// do something
injectClass.load()
}
}
Inside Koin module
factory { MyClass (get()) }
I need to call…

AndroidDev
- 35
- 5
0
votes
1 answer
MVVM: Why the ViewModel is always recreated when Activity rotated
My setup is: java Activity getting a ViewModel using Koin. All good with this, but when I rotate a phone, the ViewModel is always recreated. So how to avoid ViewModel recreation in the case? Thanks.
Activity:
private final FlowViewModel viewModel =…

Konstantin Konopko
- 5,229
- 4
- 36
- 62
0
votes
0 answers
How to set Background color to alternate rows in a ListView?
I'm trying to set a Background color for alternate items in my ListView. I'm doing the following in my Custom ArrayAdapter class:
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
val currentExpense:Expense? =…

Amey079
- 131
- 7
0
votes
0 answers
Test Koin Android modules loading
I work on a project with Koin (I'm not familiar with Koin).
I have update Koin from 3.0.2 to 3.2.2 and the test starts to fail.
class KoinDependenciesTest : KoinTest() {
@get:Rule
val koinTestRule = KoinTestRule.create {
val…

Lavan
- 157
- 9
0
votes
1 answer
Koin: getting NoBeanDefFoundException while resolving class instance in Java Activity
Using Koin3 for Java project. Currently I have to inject/get Koin instances in some Java Activities. But when I'm trying start an Activity with Koin injection, I get the following error: org.koin.core.error.NoBeanDefFoundException: No definition…

Konstantin Konopko
- 5,229
- 4
- 36
- 62