528 questions
0
votes
0
answers
24
views
Koin VM/navigation on Kotlin Multiplatform - singleton viewmodel becoming unable to launch coroutine after popBackStack
Maybe I'm doing something wrong but this seems very strange to me took me a while to track down the cause but basically ViewModels are getting corrupted whenusing popBackStack or swipe left, vm's are ...
1
vote
1
answer
75
views
How to inject Context in a class constructor and in the 2nd constructor as well, using koin?
I have a Builder class in my main class with 2 constructors:
MyClass.Builder(context: Context)
MyClass.Builder(params = params, context = Context)
I am using Koin framework.
And I need to inject ...
0
votes
0
answers
59
views
Problem using Koin with Ktor and testApplication in unit tests – KoinAppAlreadyStartedException
I'm writing unit tests for my Ktor 2.3.0 application using Koin 3.4.0 for dependency injection and MockK for mocking. I want to test my controllers using testApplication {} from ktor-server-test-host. ...
0
votes
0
answers
165
views
How to inject repository on swift ViewModel on KMP?
I'm doing a project on KMP (UI not shared). I'm writing UI for iOS with SwiftUI.
I have a shared, androidApp, iosApp modules.
In my shared module, I have repositories. I'm doing Dependency Injection ...
1
vote
1
answer
63
views
passing context to android platform in kmp project
in my kmp project i want to implement a reminder in android and ios platform .
interface ReminderScheduler {
fun scheduleReminder(reminder: Reminder)
fun cancelReminder(id: String)
}
expect ...
0
votes
1
answer
94
views
Koin NoDefinitionFoundException for Room Database in a Compose Multiplatform Project
I'm working on a Compose Multiplatform project using Koin for dependency injection, Voyager for Navigation and Room for Database Management. I'm encountering a NoDefinitionFoundException when trying ...
0
votes
1
answer
323
views
How to Properly Initialize Koin in a KMM Application on the iOS Side?
I’m working on a Kotlin Multiplatform Mobile (KMM) application and trying to set up dependency injection using Koin. The Android side works fine, but I’m running into issues when initializing Koin on ...
0
votes
1
answer
178
views
Koin not able to inject service
I downloaded a ktor setup with koin enabled, but I can't seem to get it work.
Not sure if I am doing something wrong or not, as it on the surface looks pretty OK to me.
so my Applikation.kt file looks ...
-1
votes
1
answer
332
views
Could not create instance of ViewModel using Koin
I'm trying to do a project in KMP, however, the app in the Android Version is working like a charm, but the iOS version crashes instantly.
Here is the (50% fully) error generated by xcode. I'm ...
0
votes
1
answer
618
views
How does Koin manage memory for single, factory, and scoped objects?
I’m using Koin for dependency injection in my Kotlin app and need clarification on how memory is managed for different object definitions like single, factory, and scoped.
Memory Allocation Questions:
...
1
vote
0
answers
151
views
Koin Activitity scoped injection via koinViewModel()
I am using a single app activity with jetpack compose and and using koinViewModel() (koin 4.0.0) to inject the ViewModel for the compose screens like so:
@Composable
fun LoggedInScreen(viewModel: ...
0
votes
1
answer
52
views
How to create a koin module for interface
I have an abstract class:
abstract class MyFirstViewModel(
private val firstParamArgs: FirstParamArgs,
private val secondParam: SecondParam):ViewModel(),ActionHandler{
override fun handleAction(...
0
votes
1
answer
82
views
JVM Crash when Loading Native Library in ViewModel with Koin in Compose Multiplatform
I am working on a Compose Multiplatform application running on Linux (x86_64). I have a class DesktopNativeClient that loads a native library as follows:
class DesktopNativeClient {
private ...
0
votes
1
answer
254
views
Koin error getting request scoped instance: Request scope is not ready
I'm using Koin for dependency injection inside a Ktor framework API on Android project using Kotlin. I'm declaring two request scoped instances for being able to have new instances on every new HTTP ...
1
vote
1
answer
303
views
I'm getting a missing definition type 'androidx.lifecycle.SavedStateHandle' when using Koin to inject a viewmodel. Is there a fix?
I am using Koin (ver 3.5.6) for my dependency injection on Android Jetpack Compose. I have a viewmodel I use to view file items:
class FileViewModel(
private val savedStateHandle: ...
2
votes
1
answer
1k
views
Kmp Kotlin 2.0 with Ksp Koin Annotations doesn't find generated modules on iOS
After migration Kmp project from Kotlin 1.9.24 to 2.0.0 and updating ksp from 1.9.24-1.0.20 to 2.0.0-1.0.24, Android build works but iOS doesn't compile because it can't find generated Koin modules... ...
1
vote
1
answer
717
views
Koin: inject object returned by suspend function
I have object which created by suspend function like:
suspend fun someSuspendFunction(): MyPreciousObject
And I need to provide it for later injection using koin, like:
val myModule = module {
...
2
votes
0
answers
256
views
RuntimeError: Illegal cast in Kotlin Multiplatform with Decompose and Koin on Web/Wasm target
I'm trying to run a Kotlin Multiplatform project on the Web/Wasm target.
Koin version: 3.6.0-wasm-alpha2.
An error occurs when invoking a factory method to create the Decompose rootComponent.
It works ...
1
vote
1
answer
250
views
AndroidView of compose gives:: error No view found for id 0x7f0a01d2
I have been using Jetpack Compose and koin. I am facing error as below
java.lang.IllegalArgumentException: No view found for id 0x7f0a01d2
(com.pyronixhc2.android.app:id/fragment_container_view) for ...
3
votes
0
answers
189
views
IllegalStateException: VIEW_MODEL_KEY must always be provided by ViewModelProvider
I'm getting the error below. Does someone know how to fix it?
Below is the logcat and what I did before the error happened.
I run the Gradle update on my project (now is gradle 8.4.1)
Updated ...
1
vote
3
answers
1k
views
Inject room database into Koin in compose multiplatform
I want to inject Room db files into the koin in compose multiplatform but I get the runtime error from the injected Dao interface in the data source contractor. how can I inject it to the appModule
...
0
votes
1
answer
927
views
Koin error when starting ktor application on ktor version 3
After upgrading ktor to "3.0.0-beta-1" to test it out, and upgrading koin to the latest version "3.6.0-wasm-alpha2" I get this error when starting the application.
It points to a ...
1
vote
1
answer
1k
views
Using Koin in Compose Multiplatform targeting iOS
I'm working on a KMP project targeting android, ios and desktop and I'm using koin as DI, all works fine in Android and desktop(windows and macOS) but the build for iOS fails.
some of my dependencies ...
1
vote
2
answers
2k
views
Injecting Context from Android into SqlDelight Driver using koin within KMP
I have a Kotlin Multi-platform project, that has iOS, Android and Desktop in it, and I wanted to use SqlDelight to store data. however I'm using Koin as a DI.
Since I have several platforms, I made ...
3
votes
1
answer
2k
views
Android Koin - not found after update to 3.2.0
I was using Koin in my Android app. I was using koin version 3.1.5 and had the libs.versions.toml like that
koin = "3.1.5"
koin-android = { module = "io.insert-koin:koin-android", ...