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

Nikolai

11/12/2018, 5:51 AM
Hello, everyone Did someone tried to use ktor JsonFeature in multiplatform project? Is it available for mp projects? I have following code in common module :
Copy code
private val client = io.ktor.client.HttpClient() {
        install(JsonFeature) {
            serializer = io.ktor.client.features.json.defaultSerializer()
        }
        expectSuccess = false
    }
And during asseble compileKotlinIos fails with : error: unresolved reference: JsonFeature. Do I need to add additional dependency in iOS module, or this feature is not for multiplatform? P.S. I tried to search something like : io.ktor:ktor-client-ios-json but no luck.
g

gildor

11/12/2018, 5:57 AM
I believe serialisation is not available yet for K/N version Ktor. And K/N version of kotlinx.serialization is under development and not included to Ktor as I remember @Nikky worked on some integration kotlinx.serilization to Ktor for own project
n

Nikolai

11/12/2018, 5:58 AM
@gildor, thank you
k

kpgalligan

11/12/2018, 6:13 AM
g

gildor

11/12/2018, 6:14 AM
Ah! True
t

Tobi

11/12/2018, 9:29 AM
I recently built a simple stand-alone example using
ktor
and
kotlinx.serialization
. Maybe that helps: https://github.com/novoda/spikes/tree/master/multiplatform-http
n

Nikky

11/12/2018, 9:33 AM
@gildor i did submit dome PR for jvm serialization bu nothing more really, i ended up liking Fuel as a http client much more and am not using native serialization (its really hard to contribute to thatas well)
n

Nikolai

11/12/2018, 10:18 AM
@Tobi, did we really need to have both :
Copy code
implementation "io.ktor:ktor-client-ios:$ktor_version"
                implementation "io.ktor:ktor-client-core-ios:$ktor_version"
?
t

Tobi

11/12/2018, 10:26 AM
For now I mainly duplicated the configuration from the kotlinconf app in order to make it work: https://github.com/JetBrains/kotlinconf-app/blob/master/common/build.gradle But I am planning to revisit this soon to see whether we can remove some of the dependencies.
n

Nikolai

11/12/2018, 10:41 AM
As soon as I add:
Copy code
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
to buildscript section in whole project build.gradle I got error :
Copy code
Caused by: java.lang.ClassNotFoundException: org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin