Error while importing the generated database
See original GitHub issueBuild Environment SQLDelight version: 1.4.1 OS: macOS 10.15.6 Gradle version: 6.6 Kotlin version: 1.4.0 IDE: Android Studio 4.0.1 and IntelliJ IDEA 2020.2 AGP Version (if applicable): 4.0.1
Describe the bug After migrating and building my project, I can not import the generated database from the commonMain nor androidMain source sets. However, I can import it from the iosMain source set.
When I try to import the database from the commonMain source set, the IDE says “Add dependency on module ‘common_iosMain’”. Similarly, on the androidMain source set, it says “Add dependency on on module ‘common_iosMain’” and “Import”, but the option “Import” does not work.
Additionally, after building, the IDE gives a warning:
Duplicate content roots detected: Path [/Users/Gianfranco/Documents/UPC-Mobile/common/build/generated/sqldelight/code/UpcDatabase] of module [common_iosMain] was removed from modules [common_commonMain]
build.gradle
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
kotlin("plugin.serialization")
id("com.android.library")
id("com.squareup.sqldelight")
}
android {
compileSdkVersion(App.CompileSdk)
buildToolsVersion(App.BuildTools)
defaultConfig {
minSdkVersion(App.MinSdk)
targetSdkVersion(App.TargetSdk)
versionCode = App.VersionCode
versionName = App.VersionName
}
sourceSets {
getByName("main") {
manifest.srcFile(File("src/androidMain/AndroidManifest.xml"))
java.srcDirs("src/androidMain/kotlin")
res.srcDirs("src/androidMain/res")
}
getByName("test") {
java.srcDirs("src/androidTest/kotlin")
res.srcDirs("src/androidTest/res")
}
}
}
sqldelight {
database("UpcDatabase") {
packageName = "com.upc.common.sqldelight"
}
}
version = "1.0"
kotlin {
android()
val onPhone = System.getenv("SDK_NAME")?.startsWith("iphoneos") ?: false
if (onPhone) {
iosArm64("ios")
} else {
iosX64("ios")
}
sourceSets["commonMain"].dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.Coroutines}")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:${Versions.Serialization}")
implementation("io.ktor:ktor-client-core:${Versions.Ktor}")
implementation("com.squareup.sqldelight:coroutines-extensions:${Versions.SqlDelight}")
implementation("com.russhwolf:multiplatform-settings:${Versions.Settings}")
}
sourceSets["androidMain"].dependencies {
implementation("io.ktor:ktor-client-android:${Versions.Ktor}")
implementation("com.squareup.sqldelight:android-driver:${Versions.SqlDelight}")
}
sourceSets["iosMain"].dependencies {
implementation("io.ktor:ktor-client-ios:${Versions.Ktor}")
implementation("com.squareup.sqldelight:native-driver:${Versions.SqlDelight}")
}
sourceSets["commonTest"].dependencies {
implementation("org.jetbrains.kotlin:kotlin-test-common:${Versions.Kotlin}")
implementation("org.jetbrains.kotlin:kotlin-test-annotations-common:${Versions.Kotlin}")
}
sourceSets["androidTest"].dependencies {
implementation("org.jetbrains.kotlin:kotlin-test:${Versions.Kotlin}")
implementation("org.jetbrains.kotlin:kotlin-test-junit:${Versions.Kotlin}")
implementation("com.squareup.sqldelight:sqlite-driver:${Versions.SqlDelight}")
}
targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
binaries.withType<org.jetbrains.kotlin.gradle.plugin.mpp.Framework> {
isStatic = false
}
}
cocoapods {
summary = "UPC-Mobile with Kotlin/Native"
homepage = "https://github.com/GianfrancoMS/UPC-Mobile"
podfile = project.file("../iosApp/Podfile")
}
}
tasks.getByName("podspec").enabled = false
gradle.properties
org.gradle.jvmargs=-Xmx1536m
org.gradle.caching=true
android.useAndroidX=true
android.useMinimalKeepRules=true
kotlin.incremental.usePreciseJavaTracking=true
kotlin.code.style=official
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
xcodeproj=./iosApp
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:13 (7 by maintainers)
Top GitHub Comments
please try latest snapshot release to see if it fixes
It looks like 1.4.2 has been released, which includes the fix. So no need for snapshot and the snapshot repo