I’m encountering a build error when using a custom build type (“snapshot”) in my KMM (Kotlin Multiplatform Mobile) project with SQLDelight. The debug build works perfectly fine, but the snapshot build throws an error:
Could not resolve all files for configuration ':android:app:snapshotRuntimeClasspath'.
Could not resolve app.cash.sqldelight:android-driver:2.0.0.
Required by:
project :android:app
project :android:app > project :kmp:shared > project :kmp:core-db
> No matching variant of app.cash.sqldelight:android-driver:2.0.0 was found.
Here’s my KMM source sets configuration:
kotlin {
sourceSets {
commonMain.dependencies {
implementation(project(":kmp:core"))
implementation(project(":kmp:core-api"))
implementation(libs.sqldelight.runtime)
implementation(libs.korlibs.klock)
api(libs.sqldelight.flow.ext)
api(libs.sqldelight.primitive.adapters)
}
androidMain.dependencies {
implementation(libs.sqldelight.android.driver)
}
iosMain.dependencies {
implementation(libs.sqldelight.native.driver)
}
}
}
I’ve tried the following but haven’t found a solution:
buildTypes {
getByName("snapshot"){
initWith(getByName("release"))
matchingFallbacks.addAll(listOf("debug, release"))
}
}