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.