I'm completely new to kotlin-native. Trying to use...
# kotlin-native
m
I'm completely new to kotlin-native. Trying to use it for multiplatform mobile and when I set up
ktor
I get an error (i have narrowed it down to an issue with initializing ktor
serializer)
. Not specifically asking about the serializer issue right now, but tell me - is this how the error reports are supposed to look (local build, local simulator), or do I need to somehow symbolicate the debug builds as well? It seems that everyone talks about symbolication of kotlin-native reports in crashlytics in release builds, no one mentions how it works during development.
a
So no… thank goodness. if you add this to your Gradle build file assuming you are using the Kotlen variant and not groovy:
Copy code
kotlin {
    targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
        binaries.all {
            freeCompilerArgs += "-Xadd-light-debug=enable"
        }
    }
}
you will get very nice stack traces for your Kotlin code
❤️ 1
also I wish someone showed this to me earlier, but there’s a super cool plugin that allows you to set break points in your kotlin code from xcode: https://github.com/touchlab/xcode-kotlin
hope that helps
@Michal Klimczak ^
m
@Alexander Black thanks a ton! I have just checked it and it helps indeed. When I have run the app from Android Studio, I got a nice stacktrace in the "Run" menu that points me exactly to the root case. However sometimes running from Android Studio to iOS simulator doesn't work and I'm using xcode. In that case, the same error is still somewhat cryptic. Where did you get the
add-light-debug=enable
trick from? I was looking for something similar but didn't find any nice articles about crashes and light debugging of kotlin native apps.
Okay, I just found a post from yesterday (I love it how there's new stuff every day to solve your problems when you are dealing with new programming stuff ;)) https://benasher.co/kotlin-binary-debugging/. Might be useful for someone. Anyway, if you still have something interesting, I would love to read it Alexander.
a
Excellent! Glad I could help. 🙂 Ya so much to learn, but it’s fun. Keep with it.