Upload mappings for Android
- 1
Download CLI
Required - 2
Authenticate
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
Inject and upload
RequiredAGP v8 or later
Automatic mappings uploading is handled through the Gradle build process on Android.
Install the PostHog Android Gradle Plugin on your app's
build.gradle.ktsfile.KotlinIf you are running this in CI/CD, you can configure the CLI directly on the Gradle task instead of relying on
POSTHOG_CLI_HOST,POSTHOG_CLI_PROJECT_ID, andPOSTHOG_CLI_API_KEYenvironment variables:KotlinYou can also set
postHogExecutableif you want to use a customposthog-clipath. - 4
Upload native debug symbols (NDK)
OptionalRequires PostHog Android SDK 3.57.0 or later with
errorTrackingConfig.captureNativeCrashesenabled, Gradle plugin 1.5.0 or later, and CLI 0.7.32 or later.If your app includes native C or C++ code built with the NDK, upload the
.sodebug symbols so native crash stack traces resolve to function names, files, and line numbers.The Gradle plugin registers an
uploadPostHogNativeSymbols<Variant>task that reads the variant's unstripped native libraries and uploads every one carrying debug info and a build ID. When your app module builds native code (CMake or ndk-build), the task runs automatically afterassemble,install, orbundle, for minified and non-minified builds alike.If your app only bundles prebuilt
.sofiles from dependencies, run the task explicitly:TerminalYou can also upload a directory of
.sofiles directly, without the Gradle plugin:TerminalPostHog matches crash frames to uploaded symbols by each library's GNU build ID, which the NDK emits by default. Each build has its own build ID, so symbols must be re-uploaded for every build you ship.