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"))
}
}
I think your matchingFallbacks
syntax is wrong. Try changing it to matchingFallbacks.addAll(listOf("debug", "release"))
You are quite close with matchingFallbacks
here. I have the same problem and we have a multimodule project.
This article points that you need to specify matchingFallbacks
for "snapshot" build type of every module. In our case it solved the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With