When I use @KoinViewModel and build, it tips this ...
# koin
f
When I use @KoinViewModel and build, it tips this warining. How can I fix it?
Copy code
'fun <reified T : ViewModel> Module.viewModel(qualifier: Qualifier? = ..., noinline definition: Scope.(ParametersHolder) -> T): KoinDefinition<T>' is deprecated. Moved ViewModel DSL package. Remove old imports and use org.koin.core.module.dsl.*.
kotlin 2.0.21 ksp 2.0.21-1.0.26 koin 4.0.0 koin annotations 1.4.0
1
p
just remove the imports where you are using it and replace it with org.koin.core.module.dsl.* You could try the IDE to actually replace it.
f
The code was generated by koin-annotions and I can't change it. The version I'm using is 1.4.0.
p
can you show me the gradle where you declare dependencies ?
to clean generated code just run
./gradlew clean
f
This is my gradle file,and it tips warning every time it builds.
Copy code
commonMain.dependencies {
    // Koin
    implementation("io.insert-koin:koin-core:4.0.0")
    api("io.insert-koin:koin-annotations:1.4.0")
    implementation("io.insert-koin:koin-compose-viewmodel:4.0.0")
    commonMain.configure { kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin") }
}

ksp {
    arg("KOIN_USE_COMPOSE_VIEWMODEL", "true")
    arg("KOIN_CONFIG_CHECK", "true")
}
> Task composeAppcompileReleaseKotlinAndroid w: file///../composeApp/build/generated/ksp/metadata/commonMain/kotlin/org/koin/ksp/generated/KoinDefault 563731298.kt19:63
c
a
is it for Koin Annotations? did you tried Koin Annotations 2.0-Beta1. It's fixing the import problem