Michal Klimczak
11/25/2025, 4:54 PMkotlin = "2.1.10"
ksp = "2.1.10-1.0.31" //tried ksp2 as well
koin = "4.1.1"
koinAnnotations = "2.2.0"
More details in 🧵 as not to spam here too muchMichal Klimczak
11/25/2025, 4:55 PMCaused by: org.koin.core.error.NoDefinitionFoundException: No definition found for type 'com.example.android.presentation.main.MainViewModel). Check your Modules configuration and add missing type and/or qualifier!). I tried both legacy and new viewmodels via appropriate ksp flag (noticed that 1.x generated the legacy viewmodels).
The imports and @KoinViewModel annotation are the same for generated and non-generated viewmodels. It doesn't matter if I generate a viewmodel with dependencies or not (removed them to be sure it's not the issue). The visibility of those viewmodels doesn't seem to matter (internal or public), their dependencies too (even copied dependencies of the working one to non-working one) or even if they are placed in the same package.Michal Klimczak
11/25/2025, 4:57 PMpackage com.example.android.presentation.auth.incomplete
...
import org.koin.android.annotation.KoinViewModel
@KoinViewModel
internal class IncompleteUserViewModel(
private val updateAuthUserDataUseCase: UpdateAuthUserDataUseCase,
savedStateHandle: SavedStateHandle,
) : ViewModel() {
Not generated
package com.example.android.presentation.auth.incomplete
...
import org.koin.android.annotation.KoinViewModel
@KoinViewModel
internal class MainViewModel(
private val updateAuthUserDataUseCase: UpdateAuthUserDataUseCase,
savedStateHandle: SavedStateHandle,
) : ViewModel() {Michal Klimczak
11/25/2025, 5:10 PMMichal Klimczak
11/25/2025, 5:13 PMw: [ksp] Generating 'defaultModule' with 22 definitions
w: [ksp] Koin Configuration Generated in 118.316417ms
w: [ksp] [Deprecation] 'defaultModule' generation is deprecated. Use KSP argument arg("KOIN_DEFAULT_MODULE","true") to activate default module generation.
w: [ksp] Koin Configuration Generated in 7.031833ms
w: [ksp] Koin Configuration Check ...
w: [ksp] no module found
w: [ksp] Koin Configuration Check done in 8.295750ms
This no module found is a bit suspiciousMichal Klimczak
11/25/2025, 5:15 PMMichal Klimczak
11/25/2025, 6:00 PMMichal Klimczak
11/25/2025, 7:50 PMmodule is never generated (nor are some of the viewmodels inside default module and it's probably part of the same issue)
@Module
@ComponentScan("com.example.android")
class AndroidModule {
@Factory
fun provideDummy() = Dummy()
}
val androidModule = AndroidModule().module
@Single
class DummyMichal Klimczak
11/26/2025, 9:14 AMstefanober
11/26/2025, 3:13 PMMichal Klimczak
11/26/2025, 3:20 PMMichal Klimczak
11/26/2025, 3:21 PMMichal Klimczak
11/26/2025, 6:09 PMval invalidSymbols = koinMetaDataScanner.findInvalidSymbols(resolver)
if (invalidSymbols.isNotEmpty()) {
return invalidSymbols // EXIT EARLY - Don't generate ANYTHING
}
It created a super weird behavior where it only generates e.g. 22/46 viewmodels, even more weirdly, the exact ones that are marked invalid in log mind blown.
The fix would be to create what we can in each round without exiting early.
A quick and dirty implementation of the fix (with claudes help) that works in my case: https://github.com/micHar/koin-annotations/pull/1/files
If you want, I'd be glad to prepare a clean MR @arnaud.giuliani, but would love to hear your thoughts about this issue first, maybe I got that all wrong.
I'm also not sure if there shouldn't be some additional check / fail during the compilation that would explicitly fail the processing and say what's wrong, but I'm not proficient in ksp processors.