getsentry / sentry-kotlin-multiplatform

Sentry SDK for Kotlin Multiplatform
MIT License
137 stars 19 forks source link

Does My iOS KMM Library Need to Be Static For dSYM to Work Properly? #106

Closed alexwhb closed 1 year ago

alexwhb commented 1 year ago

Description

A point I've found endlessly confusing and not well explained on the Kotlin docs... do I need my iOS shared library to be static? If so why? and if not why do I not seem to be getting line numbers from my dynamic lib crash reports? Are there any additional Gradle configs I might be missing?

Here's what my Gradle cocoapods config looks like:


    cocoapods {
        // Configure fields required by CocoaPods.
        summary = "some description"
        homepage = "myurl.com"
        pod("Sentry", "~> 8.4.0")
        ios.deploymentTarget = "14"
        framework {

            // You can change the name of the produced framework.
            // By default, it is the name of the Gradle project.
            baseName = "shared"

            // this needs to be false in order to view SwiftUI previews, but needs to be true
            // to get symbolical builds. :/
            isStatic = false

            export("co.touchlab:kermit:$kermit_version")
        }
    }
buenaflor commented 1 year ago

Hi, if you use cocoapods you shouldn't need isStatic to symbolicate your stacktraces, if you're unsure about the setup you could take a look at the samples. The only time isStatic is necessary would be if you're using SPM to include the Sentry dependency (at least for now) instead of cocoapods.

Maybe you did already but did you go through the uploading debug symbols steps?

alexwhb commented 1 year ago

@buenaflor That's great to know. Thank you so much.

I have uploaded my debug symbols, but with no success all I see are the standard stack frames with no source mapping on iOS unless I change my library to static then I weirdly do see the mapping. I'm kinda thinking it's either a gradle issue on my end or maybe I'm not uploading the correct dSYM file when generating the dynamic framework. I'll take a look at the sample and see if something becomes obvious that i missed.

Thanks so much for your response.

here's an example of what I mean by mapping. This comes from a build that I generated the static framework for. Notice the kotlin file and line number. I get the same stack frame with the dynamic library, just without the kotlin file name and line number reference.

Screenshot 2023-07-13 at 3 47 53 PM
buenaflor commented 1 year ago

Hm, that's odd. Is that reproducible on your https://github.com/alexwhb/Sentry-KMM-Bug repo as well?

alexwhb commented 1 year ago

@buenaflor Good question. I'll give that a test today and let you know. 👍

alexwhb commented 1 year ago

@buenaflor I figured it out! I was missing --include-sources flag in my sentry-cli debug-files upload. Now it's working for my dynamic library too. 😄 Thanks for your help. So happy to have this system working well at last. 😄

buenaflor commented 1 year ago

@alexwhb I see - good to know! Feel free to write any further feedback, we really appreciate it!

kahest commented 1 year ago

Closing as resolved - you're still welcome to leave more feedback or insights :)