Upload debug symbols for Kotlin Multiplatform
Kotlin Multiplatform apps produce different debug symbols for each target. Configure uploads for every target where you ship minified or native code.
- 1
Download the PostHog CLI
RequiredInstall
posthog-cli: - 2
Authenticate the PostHog CLI
RequiredTo authenticate the CLI, call the
logincommand. This opens your browser where you select your organization, project, and API scopes to grant:TerminalIf you are using the CLI in a CI/CD environment such as GitHub Actions, you can set environment variables to authenticate:
Environment Variable Description Source POSTHOG_CLI_HOSTThe PostHog host to connect to [default: https://us.posthog.com] Project settings POSTHOG_CLI_PROJECT_IDPostHog project ID Project settings POSTHOG_CLI_API_KEYPersonal API key with error tracking writeandorganization readscopesAPI key settings You can also use the
--hostoption instead of thePOSTHOG_CLI_HOSTenvironment variable to target a different PostHog instance or region. For EU users:Terminal - 3
Upload Android mappings
If your Android release uses ProGuard or R8, apply the PostHog Android Gradle plugin to the Android application module. The plugin injects a mapping ID into the app and uploads the matching mapping file during the Gradle build.
androidApp/build.gradle.ktsFollow the Android mappings guide for authentication options and the complete Gradle configuration.
- 4
Upload iOS dSYMs
The iOS app's dSYM files let PostHog resolve Kotlin and Swift frames. In the Xcode app target:
- Open Build Settings and set Debug Information Format to DWARF with dSYM File for Release builds.
- Set User Script Sandboxing (
ENABLE_USER_SCRIPT_SANDBOXING) to No. - Add a Run Script build phase after the build phases that generate the app and dSYMs.
- Add this script:
Terminal- Add this path to the build phase's Input Files:
textIf your production configuration has another name, update the
CONFIGURATIONcheck. Add--include-sourceto the upload command if you want source code context in stack traces. See the iOS dSYM guide for troubleshooting and test-crash instructions. - 5
Upload web source maps
For Kotlin/JS, run your production browser distribution task and locate the generated JavaScript bundle and source map. Inject PostHog metadata, upload the source map, and deploy the injected assets:
TerminalThe deployed JavaScript files must be the files modified by
sourcemap inject. If your web target uses another output format, follow the web source map guide for the generated assets.
Compose Desktop's default release configuration keeps readable class names, source file names, and line numbers, so it does not need a mapping upload. The PostHog Kotlin Multiplatform SDK cannot restore readable stack traces for JVM desktop builds that use custom obfuscation because those builds do not include the map ID required to match an exception with its mapping file.