https://kotlinlang.org logo
#ktor
Title
# ktor
s

Steven

04/25/2019, 12:04 PM
Hi, i was wondering if ktor client-side was compatible with all api versions of android? I saw in the FAQ that ktor servers were only for android 27 and up, but i didn't see anything for ktor clients. I am asking because i have a connection "closed by peer" error on kitkat but works on other versions
e

e5l

04/25/2019, 12:21 PM
Hi @Steven, what client engine do you use?
s

Steven

04/25/2019, 12:25 PM
The default one
e

e5l

04/25/2019, 1:13 PM
Could you list the dependency? 🙂
s

Steven

04/25/2019, 1:35 PM
yes i am using: import io.ktor.client.HttpClient val client = HttpClient() client.get<String> { ... } Gradle Dependencies: commonMain: implementation("io.ktorktor client core$ktor_version") androidMain: implementation("io.ktorktor client android$ktor_version") iOSMain: implementation("io.ktorktor client ios$ktor_version") ktor_version = 1.1.4 kotlin version = 1.3.30
e

e5l

04/25/2019, 1:45 PM
It could be an API difference in android. Could you try using
implementation("io.ktor:ktor-client-okhttp:$ktor_version")
to check?
s

Steven

04/25/2019, 1:46 PM
ok i'll try
r

russhwolf

04/25/2019, 2:06 PM
The newest versions of okhttp don't support kitkat anymore
You'd need to stick to 3.12.x instead of 3.14.x
not sure what ktor will pull in by default
s

Steven

04/25/2019, 2:28 PM
After doing multiple tests, i have figured out that some of our api calls made in our servers refuses android kitkat (probably something about SSL certificates, we need to fix asap!).
Thank you very much for your time, sorry for wasting it.... but at least we know that ktor client-side works well 👍 (i have confirmed with working urls)
3 Views