Hi, I am developing multiplatform library based on...
# ktor
v
Hi, I am developing multiplatform library based on Ktor. Everything works fine until I enable Arxan code protection. With this modification all ktor request fail with exception: java.lang.Exception: com.aaa.aaa.aaa.AAA cannot be cast to io.ktor.client.call.HttpClientCall. Any idea how to fix it?
e
Hi @Vojtech Hrdina, what version of ktor do you use?
v
now 1.2.2, before 1.1.5
Android dependencies: ‘coroutines_android’: “org.jetbrains.kotlinxkotlinx coroutines android${versions.coroutines}“, ‘coroutines_core’ : “org.jetbrains.kotlinxkotlinx coroutines core${versions.coroutines}“, ‘serialization’ : “org.jetbrains.kotlinxkotlinx serialization runtime${versions.serialization_runtime}“, ‘ktor_json’ : “io.ktorktor client json jvm${versions.ktor}“, ‘ktor_serialization’: “io.ktorktor client serialization jvm${versions.ktor}“, ‘ktor_android’ : “io.ktorktor client android${versions.ktor}“, ‘ktor_mock’ : “io.ktorktor client mock jvm${versions.ktor}“, ‘ktor_logging’ : “io.ktorktor client logging jvm${versions.ktor}“, ‘ktor_okhttp3’ : “io.ktorktor client okhttp${versions.ktor}“, versions: kotlin_version=1.3.40 kotlin_native_version=1.3.40 gradle_plugin=3.4.1 coroutines=1.2.2 serialization_runtime=0.11.1 ktor=1.2.2 kotlin_serialization=1.3.40
l
I experienced similar issue using Gson library. The debug build worked normally, but the release build with code obfuscation caused the problem. And I had to put
@SerializedName
annotations to properties which need to be serialized into json to solve the issue. I'm not sure this relates to your case.
v
I am not using Gson and everything works fine for proguard enabled builds. Ktor stop working only for binary code protected builds. I will have to use retrofit or other framework instead ktor for android builds…
@e5l Any idea how to fix that? We have temporary solution - our own library which use retrofit for android and ktor for ios, but we would like to use ktor for both.
👀 1