Does the following combination of version are comp...
# koin
p
Does the following combination of version are compatible:
Copy code
koinCore = "3.6.0-Beta4"
koinAnnotations = "1.3.1"
kotlin = "2.0.0"
ksp = "2.0.0-1.0.21"
using KMP?
Is not generating
defaultModule
or any other module.
p
I'm not sure, brow. My project is not so updated. But it's working perfect with:
Copy code
koin = "3.5.6"
koin-annotations-bom = "1.3.0"

ksp = "1.9.22-1.0.17"
kotlin = "1.9.22"
p
I will try that set of versions and confirm. Thanks. Maybe there are breaking changes in ksp 2.
h
Hi! I'm using this config:
Copy code
ksp = "2.0.0-1.0.21"
koin-bom = "3.6.0-alpha3"
koinVM = "1.2.0-Beta4"
kotlin = "2.0.0"
p
Hey hectorruiz, interesting 🤔. Will try, thanks 👍
❤️ 1
A bit better now. I was missing to add this line:
Copy code
add("kspJvm", "io.insert-koin:koin-ksp-compiler:1.3.1")
Now it generates the Default.kt file but uses:
import org.koin.androidx.viewmodel.dsl.viewModel
and the compiler complains about not finding above import. I am running the JVM target if if it helps. Also using this:
Copy code
@KoinViewModel
class AnnotationTestViewModel : androidx.lifecycle.ViewModel()
Seems to work with the dependencies that I had if I don’t use:
Copy code
@KoinViewModel
The moment I use above annotation, the genrated files don’t compile. The reason is, the generator creates an import of:
Copy code
import org.koin.androidx.viewmodel.dsl.viewModel
and it should be:
Copy code
import org.koin.compose.viewmodel.dsl.viewModel
Which is the kmp ViewModel import
b
My koin is working with all of those versions. I do have these floating around in my build.gradle.kts that may be helping out, I’m not sure which depenendencies needed these but maybe try them.
Copy code
tasks.withType<KotlinCompilationTask<*>>().configureEach {
  if (name != "kspCommonMainKotlinMetadata") {
    dependsOn("kspCommonMainKotlinMetadata")
  }
}

ksp {
  arg("KOIN_CONFIG_CHECK", "true")
}

dependencies {
  add("kspCommonMainMetadata", libs.koin.ksp.compiler)
}

kotlin {
  sourceSets {
    commonMain {
      kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
      dependencies {
        implementation(project.dependencies.platform(libs.koin.bom))
        implementation(project.dependencies.platform(libs.koin.annotations.bom))
        implementation(libs.koin.core)
        implementation(libs.koin.compose)
        implementation(libs.koin.annotations)
      }
    }
  }
}
p
Oh cool thanks, will try that
Hey Blake, I did tried the boms, which is basically the only thing different from what I had and I still face the same error. One thing I notice, in my project I am using this koin module:
Copy code
implementation(libs.koin.compose.viewmodel)

// catalog
koin-compose-viewmodel = { module = "io.insert-koin:koin-compose-viewmodel", version.ref = "koinComposeMultiplatform" }
Not sure if that module is bringing a bad transitive dependency or something. The error as I said before is that the generated code uses function:
Copy code
import org.koin.androidx.viewmodel.dsl.viewModel
and not function
Copy code
import org.koin.compose.viewmodel.dsl.viewModel