Skip to content Skip to sidebar Skip to footer

Compiler Cannot Resolve Classes In Io.ktor.client.features.logging

I'm trying to add logging for Ktor http requests in Android application. According to docs I have to add gradle dependency implementation 'io.ktor:ktor-client-logging:$ktor_version

Solution 1:

For the ktor-client-logging you have to have the dependency set for each platform:

commonMain {
    dependencies {
        implementation "ch.qos.logback:logback-classic:1.2.3"
        implementation "io.ktor:ktor-client-logging:$ktor_version"
    }
}

androidMain {
    dependencies {
        implementation "io.ktor:ktor-client-logging-jvm:$ktor_version"
    }
}

iosMain {
    dependencies {
        implementation "io.ktor:ktor-client-logging-native:$ktor_version"
    }
}

as for the meta META-INF/ktor-http.kotlin_module add to the app/build.gradle inside the android {} block:

android {
    packagingOptions {
        exclude 'META-INF/common.kotlin_module'
        exclude 'META-INF/*.kotlin_module'
    }
}

Post a Comment for "Compiler Cannot Resolve Classes In Io.ktor.client.features.logging"