Chirag Redij
05/06/2026, 6:40 AMkotlin = "2.3.10"
ksp = "2.3.2"
koin-core = "4.2.1"
koin-annotations = "4.2.1"
koin-ksp-compiler = "2.3.1"
koin-annotations = { group = "io.insert-koin", name = "koin-annotations", version.ref = "koin-annotations" }
koin-ksp-compiler = { group = "io.insert-koin", name = "koin-ksp-compiler", version.ref = "koin-ksp-compiler" }
In my multi module setup with build config plugins.
Generated ksp file for annotation.
import org.koin.meta.annotations.*
@MetaModule("com.nymbusforge.purrtunes.core.data.di.CoreDataModule",id="9s994x", includes=["com.nymbusforge.purrtunes.core.data.di.PlatformCoreDataModule_Expect"])
public class _KSP_ComNymbusforgePurrtunesCoreDataDiCoreDataModule
Error
e: file:///Users/chiragredij/AndroidStudioProjects/NymbusForge/PurrTunes/core/data/build/generated/ksp/metadata/commonMain/kotlin/org/koin/ksp/generated/KoinMeta-83d5a1da.kt:3:17 Unresolved reference 'meta'.
Unresolved reference 'MetaModule'. Unresolved reference 'MetaDefinition'.
There is no error during build process, it crashes when trying to run the app. What should be the correct configuration.
This is the plugin file I add to my modules
import com.google.devtools.ksp.gradle.KspExtension
import com.nymbusforge.purrtunes.convention.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.findByType
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
/**
* Convention plugin for KSP (Kotlin Symbol Processing) annotation processing.
*
* This plugin:
* - Applies the KSP Gradle plugin
* - Configures KSP to generate code in the correct directories
* - Sets up common KSP compiler arguments
* - Configures KSP for all target platforms (Android, iOS)
*/
class KspConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
// Apply the KSP Gradle plugin to enable annotation processing
with(pluginManager) {
apply("com.google.devtools.ksp")
}
// Configure KSP extension for proper code generation paths
extensions.configure<KspExtension> {
arg("room.schemaLocation", "$projectDir/schemas")
arg("room.incremental", "true")
arg("room.expandProjection", "true")
// Set the directory where KSP will generate Kotlin source files
// This is important for IDE integration and build caching
arg("generateKotlin", "true")
// Enable incremental processing for faster builds
// KSP will only reprocess changed files
arg("incremental", "true")
// Generate metadata for better error messages
arg("apoption", "ksp.incremental.log=true")
}
// CRITICAL FIX: Use afterEvaluate to ensure KMP plugin is configured first
afterEvaluate {
extensions.findByType<KotlinMultiplatformExtension>()?.apply {
sourceSets.named("commonMain") {
kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
}
}
}
// FIX: Properly declare task dependencies for all KSP tasks
tasks.configureEach {
if (name.startsWith("ksp") && name != "kspCommonMainKotlinMetadata") {
// All platform-specific KSP tasks must depend on metadata generation
dependsOn("kspCommonMainKotlinMetadata")
}
// Ensure all Kotlin compilation tasks wait for their corresponding KSP tasks
if (name.startsWith("compileKotlin")) {
val kspTaskName = name.replace("compileKotlin", "ksp")
tasks.findByName(kspTaskName)?.let { kspTask ->
dependsOn(kspTask)
}
}
}
// CRITICAL FIX: Explicitly handle KSP task dependencies
tasks.withType<com.google.devtools.ksp.gradle.KspAATask>().configureEach {
if (name != "kspCommonMainKotlinMetadata") {
// All KSP tasks must run after commonMain metadata is generated
mustRunAfter(tasks.named("kspCommonMainKotlinMetadata"))
dependsOn(tasks.named("kspCommonMainKotlinMetadata"))
}
}
}
}
}Thomas Richtsfeld
05/06/2026, 6:45 AMChirag Redij
05/06/2026, 6:49 AMThomas Richtsfeld
05/06/2026, 6:50 AMChirag Redij
05/06/2026, 6:55 AMThomas Richtsfeld
05/06/2026, 6:57 AMFrançois
05/06/2026, 9:09 AMChirag Redij
05/09/2026, 9:52 AM