Hello, just a quick question did the CIO Client go...
# ktor
b
Hello, just a quick question did the CIO Client got moved in 2.0? I just migrated from 1.6.7, and the import
import io.ktor.client.engine.cio.CIO
now show an error. I have
implementation("io.ktor:ktor-client-core:2.0.2")
in the commonMain dependencies of my KMM app, but after looking into the related jar downloaded by Gradle it appear to now be empty.
a
Yes. Do you have the
ktor-client-cio
dependency? For what source set do you define this dependency?
b
My bad I meant I have
ktor-client-cio:2.0.2
dependency in commonMain, not ktor-client-core, which I have too, but is irrelevant here
a
I’ve checked and it works on my machine. Could you please try to clean the Gradle cache by removing
~/.m2
and
~/.gradle
directories?
b
I cleared the Gradle cache like you asked but still have the same pb.
My build.gradle.kts sourceSet look like this:
Copy code
sourceSets {
        val commonMain by getting {
            dependencies {
                implementation("io.github.aakira:napier:${Version.napier}")
                implementation("io.ktor:ktor-client-core:${Version.ktor}")
                implementation("io.ktor:ktor-client-serialization:${Version.ktor}")
                implementation("io.ktor:ktor-client-logging:${Version.ktor}")
                implementation("io.ktor:ktor-client-cio:${Version.ktor}")
                implementation("io.ktor:ktor-client-content-negotiation:${Version.ktor}")
                implementation("io.ktor:ktor-serialization-kotlinx-json:${Version.ktor}")
                implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:${Version.serialization}")
                api("ch.qos.logback:logback-classic:${Version.logback}")
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val androidMain by getting
        val androidTest by getting
        val iosX64Main by getting
        val iosArm64Main by getting
        val iosSimulatorArm64Main by getting
        val iosMain by creating {
            dependsOn(commonMain)
            iosX64Main.dependsOn(this)
            iosArm64Main.dependsOn(this)
            iosSimulatorArm64Main.dependsOn(this)
        }
        val iosX64Test by getting
        val iosArm64Test by getting
        val iosSimulatorArm64Test by getting
        val iosTest by creating {
            dependsOn(commonTest)
            iosX64Test.dependsOn(this)
            iosArm64Test.dependsOn(this)
            iosSimulatorArm64Test.dependsOn(this)
        }
    }
My Version.kt:
Copy code
object Version {
    // Global
    const val gradle = "7.2.1"
    const val kotlin = "1.6.10"

    // Shared
    const val napier = "2.6.1"
    const val ktor = "2.0.2"
    const val serialization = "1.3.3"
    const val logback = "1.2.11"

    // Android
    const val material = "1.6.1"
    const val appcompat = "1.4.1"
    const val activityCompose = "1.4.0"
    const val compose = "1.1.1"
    const val lifecycle = "2.4.1"
    const val junit4 = "1.1.1"
}
a
Does a compilation error occur or do you see only an error in IDE?
b
When I try to compile I also get "Unresolved reference: CIO"
Oh ok, the import
import io.ktor.client.engine.cio.CIO
got automatically removed by my IDE because unused, if I add it back, it compile, even if Android Studio still show the "Unresolved reference: CIO" I'm still able to compile and run my app
It's a bit weird but thank you for help