Jonathan
07/31/2025, 6:37 PMABRAR WIRYAWAN
08/07/2025, 3:56 AMEdgar Avuzi
08/08/2025, 3:10 AMAbhimanyu
08/08/2025, 5:37 PMjava.lang.IllegalStateException: KoinApplication has not been started
Pedro Francisco de Sousa Neto
08/09/2025, 2:45 PMPedro Francisco de Sousa Neto
08/12/2025, 12:03 AMAlexey
08/12/2025, 4:09 AMactual val dataStoreModule: Module = module {
single {
createProfileDataStore {
createAndroidFilePath(get(), "profile.json")
}
}
single {
createSettingsDataStore {
createAndroidFilePath(get(), "settings.json")
}
}
}
But if i add named, all works good, it good practice, or u have better way for provide 2 different datastore in kmp? In hilt(android native) works good without named param
enum class DataStoreType {
Profile,
Settings
}
actual val datastoreModule: Module = module {
single<DataStore<ProfileDto>>(
named(DataStoreTypes.Profile)
) {
createProfileDataStore {
createAndroidFilePath(get(), "profile.json")
}
}
single<DataStore<SettingsDto>>(
named(DataStoreTypes.Settings)
) {
createTokensDataStore {
createAndroidFilePath(get(), "settings.json")
}
}
}
Dumitru Preguza
08/18/2025, 1:30 PMval analytics = koinInject<Analytics>()
or something like:
val analytics = koin.get<Analytics>()
I think I saw some other APIs as well, it's a bit confusing.
Secondly, why there is:
startKoinApplication {} - works in common code too
and
startKoinApplicationMP {} -works in common code too
and
startKoin{}
and other APIs - again it makes things confusing.Dallasphillips24
08/19/2025, 2:56 PMval inventoryModule = module {
factory<HttpClient> { (clientFactory: IHttpClientFactory) -> clientFactory.createClient() }
single<IInventoryManager>{HttpInventoryManager(get())}
viewModelOf(::InventoryItemViewModel)
}
...
interface IHttpClientFactory {
fun createClient(): HttpClient
}
In androidMain
...
class OkHttpClientFactory(): IHttpClientFactory {
override fun createClient(): HttpClient {
return HttpClient(OkHttp)
}
}
...
actual fun platformModules(): Array<Module> {
val httpModule = module {
singleOf<IHttpClientFactory>(::OkHttpClientFactory)
}
return arrayOf(
httpModule
)
}
back in commonMain
KoinApplication(application = {
modules(
inventoryModule,
*platformModules()
)
})...
All this results in Caused by: org.koin.core.error.NoParameterFoundException: Can't get injected parameter #0 from DefinitionParameters[] for type 'com.bigballard.tool.http.IHttpClientFactory'
Dallasphillips24
08/19/2025, 2:59 PMIInventoryManager
(impl HttpInventoryManager
) which needs an HttpClient
which is provided by the factory as seen.Siggi Gunnarss
08/20/2025, 9:03 AMclass GreetingHelper : KoinComponent {
private val greeting : Greeting by inject()
fun greet() : String = greeting.greeting()
}
The greeting
could be public there and iOS would have direct access to the class (via the GreeterHelper as a factory), right?Lukas Anda
08/23/2025, 6:15 PMDallasphillips24
08/24/2025, 3:20 PMInventoryManager
has a constructor dependency on an HttpClient
which is provided by an implementation of IHttpClientFactory
. The manager and factory interface are defined in commonMain. The implementation of the factory is OkHttpClientFactory
in androidMain, provided in a module also in androidMain. inventoryModule
in commonMain has a factory defined for the client factory to create instances of the http clients. The koin application is created in androidMain.
koin throws an error when the factory is called, stating that it cant find a parameter for IHttpClientFactory
even though one is provided by the module in androidMain.Dallasphillips24
08/24/2025, 3:21 PMDallasphillips24
08/24/2025, 3:22 PMWukongRework.exe
08/26/2025, 11:48 PMKoinMultiplatformApplication
and I’m running into a ClosedScopeException
when rotating the screen. A bit of googling later leads me to this GitHub issue https://github.com/InsertKoinIO/koin/issues/1773 but the suggested solution of using KoinContext
doesn’t appear to be a valid solution anymore as the function has been deprecated in 4.1.0 (which I am using). Does anyone know if there is a new API to use in 4.1.0 to fix this issue?
Thanks in advance!Umit AYDIN
08/27/2025, 10:38 PMMarc
08/28/2025, 10:14 AM// In my feature module
val featureModule = module {
singleOf(::WhateverImplementation){ binds<WateverInterface>() }
// Main app module
...
install(Koin) {
modules(featureModule)
}
I’d like something like (pseudocode)
//feature module
fun Application.featurePlugin() {
-> inject here the featureModule to Koin
rest of the feature configuration
}
// main app module
fun Application.main() {
featurePlugin() <- this way I can keep all configs isolated into feature module and i just need to add it into a single entry point
}
Does it make sense? is there any solution/idea already implemented or that would make more sense than this?
ty!esdrasdl
08/28/2025, 7:52 PMCrashed: com.apple.main-thread
0x14f28 class_rw_t::methods() const
0x125a8 class_copyMethodList
0x21ae42c createTypeInfo(objc_class*, TypeInfo const*, TypeInfo const*)
0x21ae274 getOrCreateTypeInfo(objc_class*)
0x1de4850 kfun:kotlinx.cinterop.internal.ObjectiveCKClassImpl#hashCode(){}<http://kotlin.Int|kotlin.Int> + 1852 (Primitives.kt:1852)
0x1e2bd7c kfun:kotlin.collections.HashMap.findKey#internal + 40 (Any.kt:40)
0x1e28e2c kfun:kotlin.collections.HashMap#get(1:0){}1:1? + 111 (HashMap.kt:111)
0x1f151b0 kfun:co.touchlab.stately.collections.ConcurrentMutableMap.ConcurrentMutableMap$get$1.invoke#internal + 27 (ConcurrentMutableMap.kt:27)
0x1f0f690 kfun:co.touchlab.stately.concurrency.Synchronizable#runSynchronized(kotlin.Function0<0:0>){0§<kotlin.Any?>}0:0 + 1 ([K][Suspend]Functions:1)
0x1f13d68 kfun:co.touchlab.stately.collections.ConcurrentMutableMap#get(1:0){}1:1? + 27 (ConcurrentMutableMap.kt:27)
0x1f243cc kfun:org.koin.ext#getFullName__at__kotlin.reflect.KClass<*>(){}kotlin.String + 85 (Map.kt:85)
0x1f1c94c kfun:org.koin.core.module.Module#indexPrimaryType(org.koin.core.instance.InstanceFactory<*>){} + 100 (BeanDefinition.kt:100)
0x217a5a0 kfun:my.package.core.network.networkModule$1.$<bridge-DNN>invoke(org.koin.core.module.Module){}#internal + 112 (Module.kt:112)
0x1f2408c kfun:org.koin.dsl#module(kotlin.Boolean;kotlin.Function1<org.koin.core.module.Module,kotlin.Unit>){}org.koin.core.module.Module + 38 (ModuleDSL.kt:38)
0x21843fc kfun:my.package.startComposeModules$1.$<bridge-DNN>invoke(org.koin.core.KoinApplication){}#internal + 33 (ModuleDSL.kt:33)
0x1f27ba8 kfun:org.koin.core.context.MutableGlobalContext#startKoin(kotlin.Function1<org.koin.core.KoinApplication,kotlin.Unit>){}org.koin.core.KoinApplication + 1 ([K][Suspend]Functions:1)
0x219c764 objc2kotlin_kfun:my.package#startComposeModules(kotlin.String;kotlin.Function0<platform.Foundation.NSURLCredential?>){} + 41 (DefaultContextExt.kt:41)
0xae2b8 specialized AppDelegate.application(_:didFinishLaunchingWithOptions:) + 25 (AppDelegate.swift:25)
0xacfe8 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) (<compiler-generated>)
Do you have any clues?
My coworker tried to increase the koin version to 4.1.0 but the crash still happens but with a different stracktrace
Can't show file for stack frame : <DBGLLDBStackFrame: 0x367d4abb0> - stackNumber:4 - name:kfun:kotlinx.cinterop.internal.ObjectiveCKClassImpl#hashCode(){}<http://kotlin.Int|kotlin.Int> [inlined] kfun:kotlinx.cinterop.internal.ObjectiveCKClassImpl#<get-typeInfo>(){}kotlin.native.internal.NativePtr [inlined].
The file path does not exist on the file system: /opt/buildAgent/work/2d153abd4d2c0600/kotlin/kotlin-native/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/internal/ObjectiveCKClassImpl.kt
Dallasphillips24
08/29/2025, 3:14 AMgalex
08/29/2025, 6:48 AMRoger Kreienbühl
08/31/2025, 10:30 AM@Factory
fun provideLogger(@InjectedParam tag: String?): Logger {
return if (tag != null) logger.withTag(tag) else logger
}
Now I am wondering, how I can pass the tag when creating for example a singleton:
@Single
class SomeService(logger: Logger) { ... }
Is there any solution to this?Renz
09/02/2025, 12:52 AMabstract class BaseViewModel<V : BaseViewModelState<U>, U : BaseUiState> : ViewModel()
class MainViewModel(
private val cardSetUseCase: CardSetUseCase
) : BaseViewModel<MainViewModelState, MainUiState>()
val viewModelModule = module {
viewModelOf(::MainViewModel)
}
Dallasphillips24
09/03/2025, 12:12 AMJonathan
09/05/2025, 2:53 PMJonathan
09/07/2025, 2:19 AMlateinit
and enforce calling an "init" function at startup but that seems messy. Is there an obvious solution that I'm missing?Ori Spokoini
09/08/2025, 8:18 AM@KoinViewModel
class ProfileEditorViewModel(
private val userRepository: UserRepository
) : ViewModel()
And in composeApp/.../FakeUserRepo.kt
@Factory
class FakeUserRepo() : UserRepository
Currently I’m using @Provided
to suppress the injection error and then manually loading FakeUserRepo
. I also tried ComponentScan
, but it doesn’t seem to work across modules.
What’s the recommended way to handle this?s3rius
09/09/2025, 12:24 PMApiClient
class that needs a bunch of inputs. Basically like this:
@Single
class ApiClient(
val baseUrl: String,
val enableLogging: Boolean,
val cacheDirectory: Path,
val authClientId: String,
...
)
There are a few ways of providing these dependencies:
1. Tagging them all as ``@InjectedParam`` and doing a ``getApiClient { parametersOf(...) }`` once at the start of the app (to create the singleton). But this seems pretty shaky: it fails to work well with several parameters of the same type (such as ``baseUrl`` and ``authClientId``) and there's no compile-time safety.
2. Adding all those dependencies to Koins dependency graph via ``@Single`` or ``single()``, etc, using ``named<>`` to differentiate them. But that seems like you're polluting the dependency graph with dependencies that are really just details of a particular use-case.
3. Stuffing everything into a ``ApiClientConfig`` class and only providing that class?
4. Using ``@Property`` and providing everything as a properties map?
5. Not using Annotations for classes like this; instead injecting them via code in the main application where these various configurations/settings can be loaded?
I've tried a few different ways over the months but they all seem somewhat messy and dissatisfactory.
Any widsom to share? Preferable from larger codebases where this kind of mess might end up having a big impact on readability or reproducibility?Jonathan
09/09/2025, 2:37 PMcommonMain/
sourceSet. The concern I have is that “native” component scanning doesn’t seem to work. Reviewing the androidMain/
generated code I don’t see Koin declarations for classes I’ve marked with`@Single` . The generated module for actual class NativeModule
is empty. I don’t see one at all for iosMain/
. Has anyone else experienced this?
https://kotlinlang.slack.com/archives/C67HDJZ2N/p1757211546010449Suresh Maidaragi
09/15/2025, 7:16 AMslow cold start
and anr issues due to koin initialisation on one of your project wherein we have 20modules out of which around 10 are in kmp, so when tries to initialise this 10 Kmp modules using koin, it takes around ~7sec to init and move to further screens.
This modules are initialised within Application class. We already made all this koin init async still the issue persisting around. Is there work around this?? to make it initialise quicker/ondemand
when we init this 10kmp module on demand during runtime we are seeing no koin def found issues