https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

aleksey.tomin

06/01/2020, 5:49 PM
I try to use ktor-client + gson in MP project. In build.gradle.kts I’ve wrote:
Copy code
common:
                implementation("io.ktor:ktor-client-core:$ktorVersion")
                implementation("io.ktor:ktor-client-json:$ktorVersion")
                implementation("io.ktor:ktor-client-gson:$ktorVersion")
macOS:
                implementation("io.ktor:ktor-client-curl:$ktorVersion")
                implementation("io.ktor:ktor-client-core-native:$ktorVersion")
                implementation("io.ktor:ktor-client-json-native:$ktorVersion")
But when I write
import io.ktor.client.features.json.GsonSerializer
I have got the error
Unresolved reference: GsonSerializer
What I’ve done wrong?
r

russhwolf

06/01/2020, 5:54 PM
Gson only exists on JVM, so you can't use it from common. For common serialization use kotlinx-serialization via
ktor-client-serialization
👍 3
4 Views