hello guys, i have sqldelight in a KMM project, i ...
# squarelibraries
b
hello guys, i have sqldelight in a KMM project, i am getting the following error
Cannot access class 'app.cash.sqldelight.db.SqlSchema'. Check your module classpath for missing or conflicting dependencies
What am i missing?
k
Do you have SqlDelight Gradle plugin applied in the module?
b
Yes i have, it looks like i had another library that was causing the issue. Thanks fixed the issue
t
I'm having this issue. Can you explain how you fixed it? How did you determine the other library that was causing the issue?
b
I have created a separate kmm module with only sqldelight and imported it
I realize that is creating a source set and not a module, but it seems like he came to the conclusion that there was duplicate source causing the issue. I'd just like to understand how to see the issue in my project.
b
are you using cocoapods?
t
yes. I include two pods so that I can use them in iosMain. OpusKit and AppAuth.
b
i created a separate KMM module
Copy code
plugins {
alias(libs.plugins.sqldelight)
}
kotlin {
sourceSets {
        commonMain {
            dependencies {
                api(libs.sqldelight.runtime)
                api(libs.sqldelight.primitive.adapters)
                api(libs.sqldelight.coroutines.extensions)
            }
        }

        androidMain {
            dependencies {
                api(libs.sqldelight.android.driver)
                api(libs.sqldelight.androidx.paging3.extensions)
            }
        }

        iosMain {
            dependencies {
                api(libs.sqldelight.native.driver)
            }
        }
    }
}
from the main module, import
api(project(":myDatabaeModule"))
t
did you add that into iosMain only?
b
non commonMain
PS: on the database module, you should set in cocoapods
isStatic = false
i think that was the issue, however i think sqldelight is working to fix it
t
Were you able to find or open a ticket for it?
Also, can you share what the cocoapods block looks like in your database module?
b
Copy code
kotlin {
    cocoapods {
        framework {
            baseName = "myDatabaeModule"
            linkerOpts += "-lsqlite3" // this is needed for now 
            isStatic = false // this is needed for now 
        }
    }
}
t
Thanks! Is there a ticket for this? I was thinking it might be helpful to make a sample app that has the minimum amount of modifications to recreate the issue.
b
i had some discussions with their team, but i will follow up to open a ticket if still not solved
t
Thank you. I'll help create the ticket if needed. Just let me know. I can subscribe to the ticket if you find it.
K 1
I created this sample project to demonstrate the issue. https://github.com/tethridge/SqlDriverNotFound
b
nice, thanks
👍 1
t
I tried creating a separate module, but I ran into other errors that complained of not being able to find all resources. I'm curious if your project is public, so I can diff my configuration to see what I'm doing wrong?
b
what kind of resources are you referring to
t
Copy code
* What went wrong:
Execution failed for task ':databaseModule:compileDebugKotlinAndroid'.
> Could not resolve all files for configuration ':databaseModule:debugCompileClasspath'.
   > Failed to transform kotlin-stdlib-jdk8-1.9.10.jar (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.10) to match attributes {artifactType=android-classes-jar, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-api}.
      > Could not download kotlin-stdlib-jdk8-1.9.10.jar (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.10): Skipped due to earlier error
   > Failed to transform annotation-1.2.0.jar (androidx.annotation:annotation:1.2.0) to match attributes {artifactType=android-classes-jar, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=7, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-api}.
      > Could not download annotation-1.2.0.jar (androidx.annotation:annotation:1.2.0): Skipped due to earlier error
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':databaseModule:debugCompileClasspath'.
It is kind of vague. Not sure what was wrong.
139 Views