Upload mappings for Android

  1. Download CLI

    Required

    CLI v0.5.16 or later

    Install posthog-cli:

    npm install -g @posthog/cli
  2. Authenticate

    Required

    To authenticate the CLI, you can call the login command and follow the instructions:

    Terminal
    posthog-cli login

    If you are using the CLI in a CI/CD environment such as GitHub Actions, you can set environment variables to authenticate:

    Environment VariableDescriptionSource
    POSTHOG_CLI_HOSTThe PostHog host to connect to [default: https://us.posthog.com]Project settings
    POSTHOG_CLI_ENV_IDPostHog project IDProject settings
    POSTHOG_CLI_TOKENPersonal API key with error tracking write and organization read scopesAPI key settings

    You can also use the --host option instead of the POSTHOG_CLI_HOST environment variable to target a different PostHog instance or region. For EU users:

    Terminal
    posthog-cli --host https://eu.posthog.com [CMD]
  3. Inject and upload

    Required

    AGP 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.kts file.

    Kotlin
    // Available through mavenCentral()
    plugins {
    id("com.android.application")
    id("com.posthog.android") version "$version"
    ...
    }
  4. Verify mappings upload

    Checkpoint
    Confirm that mappings are successfully uploaded to PostHog.Check symbol sets in PostHog

Community questions

Was this page useful?

Questions about this page? or post a community question.