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
Install the PostHog CLI
Required - 2
Authenticate the PostHog CLI
RequiredLog in to PostHog. This opens your browser, where you approve the login:
TerminalIf posthog-cli is already logged in on this machine, import that login instead:
TerminalThese CI providers can upload with the job's OIDC token, so you don't store a personal API key in CI.
- Logged in with
hog auth login, run this once in the repository:
Terminal- An organization admin approves the request in PostHog.
- Add the
hostandprojectIdthat hog prints toposthog.json, and add the snippet it prints to the job.
In GitHub Actions, the job needs the
id-token: writepermission:YAMLRemove any personal API key from the job. A key wins over the OIDC token.
Set these environment variables in the job:
Environment variable Description Source HOG_HOSTThe PostHog host to connect to, such as https://eu.posthog.com[default: https://us.posthog.com]Project settings HOG_PROJECT_IDPostHog project ID Project settings HOG_PERSONAL_API_KEYPersonal API key with the error_tracking:writescopeAPI key settings hog reads only the
HOG_*names. The PostHog build plugins and upload scripts still pass the oldPOSTHOG_CLI_*names to hog for now, with a warning for each one. Ahogcommand you run yourself needs theHOG_*names. The migration guide lists each rename. - 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:
Terminalprocessinjects PostHog metadata into the JavaScript files, then uploads the source maps. The deployed JavaScript files must be the files it modified. 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.





