https://kotlinlang.org logo
Title
t

Thomas

05/25/2019, 2:44 PM
Adding Ktor to a project seems also to include Kotlin reflect. This makes the APK size much larger and adds Metadata annotations to all the classes which are visible when decompiling the APK. Is this intended behaviour?
😮 1
This is the dependency I added:
implementation "io.ktor:ktor-client-core-jvm:1.2.0"
Looks like the reflection is used for the reified generics:
client.get<ResponseClass>{}
. I manually excluded
kotlin-reflect
in Gradle from my project, and as expected,
client.get
(put, post, delete as well) no longer works. I just need a
HttpResponse
so I can just use the
client.call
method instead (which does not use reflection). So for now, I have a solution.
2
Why does Ktor need Kotlin reflect? Why can't it just use Java reflection for this?
e

e5l

05/28/2019, 2:16 PM
It looks like this dependency should be module local. Can you file an issue?
s

serebit

05/29/2019, 4:24 AM
Yeah, the inclusion of kotlin-reflect in ktor-client-cio doubles the disk space used by my project’s shadow jar
t

Thomas

05/30/2019, 1:40 PM
@e5l Created an issue: https://github.com/ktorio/ktor/issues/1162
:tnx: 1