Cannot generate database class in KMM project
See original GitHub issueBuild Environment SQLDelight version: 1.4.4 IDE version: Android Studio 4.1 Dialect: SQLLITE
Describe the bug I cannot get my database class to be generated in a fresh project created with KMM android/ios
In shared/build.gradle.kts
plugins {
kotlin("multiplatform")
id("com.android.library")
id("kotlin-android-extensions")
id("com.squareup.sqldelight")
}
...
sqldelight {
database("TestDatabase") {
packageName = "com.jeantuffier.testkmm.sqldelight"
}
}
In build.gradle.kts
buildscript {
repositories {
gradlePluginPortal()
jcenter()
google()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10")
classpath("com.android.tools.build:gradle:4.1.0")
classpath ("com.squareup.sqldelight:gradle-plugin:1.4.4")
}
}
group = "com.jeantuffier.testkmm"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
In settings.gradle.kts
pluginManagement {
repositories {
gradlePluginPortal()
google()
jcenter()
mavenCentral()
}
resolutionStrategy {
eachPlugin {
if (requested.id.namespace == "com.android" || requested.id.name == "kotlin-android-extensions") {
useModule("com.android.tools.build:gradle:4.0.1")
}
}
}
}
rootProject.name = "TestKMM"
include(":androidApp")
include(":shared")
I followed the documentation available here : https://cashapp.github.io/sqldelight/multiplatform_sqlite/
I cannot import/use the class TestDatabase
, so I guess it’s not generated.
I also tried to create the driver factories, it works for android but in iosMain
, I cannot access NativeSqliteDriver
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Sqldelight database schema not generated - Stack Overflow
I have a KMM project and want to use SqlDelight library, but when I build the project database schema not generated and table...
Read more >The "Database" class doesn't exist in sqldelight : r/Kotlin - Reddit
You have to build the project first so it can generate the Database class for you. After building it, it should compile as...
Read more >KMM can not preview SwiftUI : KTIJ-22229 - YouTrack
The Problem I'm having is that I can not preview the swift ui views. When clicking on resume in the preview an error...
Read more >KMM QuickStart Guide. Getting started with Kotlin…
In Android Studio, select File -> New -> New project. “Create new project” wizard will open. Select KMM Application and click Next.
Read more >What's new in Kotlin 1.7.20
Check out the performance boost on your JVM projects and compare it with ... This makes data object declarations perfect for sealed class...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Clarified the documentation on master
The documentation also says this :
It seems like the default is actually
commonMain
, but it would be nice to be able to define this value as “non relative”. In my use case, I want to share the database logic between ios and android, but my kmp project also targets backend so I created another targetclientCommon
for some of the logic that ios and android target depend on. it would be nice to be able too simply writesourceFolders = ["src/clientCommon"]