Skip to content

Android mapping upload

When R8 or ProGuard minifies your release build, it renames your classes and methods, so crash reports show names such as a.b.c. Appelium turns them back into the original names with the build's mapping.txt. Upload the mapping file of every minified build you distribute: Google Play, internal testing and other release builds. Crash reports that arrived before the upload are deobfuscated again once it is done.

flowchart LR
    Build["./gradlew assembleRelease<br/>or bundleRelease"] --> Mapping["mapping.txt"]
    Mapping -- "upload once per build" --> Appelium["Appelium"]
    Crash["Obfuscated crash report"] --> Appelium
    Appelium --> Readable["Readable stack trace<br/>in the Dashboard"]

Before you start

  • R8 writes the mapping file to app/build/outputs/mapping/<variant>/mapping.txt, for example app/build/outputs/mapping/release/mapping.txt. Builds without isMinifyEnabled = true have no mapping file and need no upload.
  • You need a workspace API key with admin permissions from API Access Settings, for example a system API key. This is not the SDK's application API key; see Authentication. Store it as a CI secret, for example in APPELIUM_TOKEN.
  • You need the application alias shown in the application's settings in the Dashboard, for example my-app-android.
  • The upload names the build with its package name, version name and version code. They must match the build that produced the mapping file.

Upload from the command line or CI

Run this right after the release build, on the same machine or CI job:

curl --fail-with-body -X POST "https://api.appelium.com/v2/symbolsFiles" \
    -H "X-Appelium-Token: $APPELIUM_TOKEN" \
    -H "X-Appelium-Application-Alias: my-app-android" \
    -H "X-Appelium-Package: com.example.myapp" \
    -H "X-Appelium-Version-Name: 1.2.3" \
    -H "X-Appelium-Version-Code: 456" \
    -H "Content-Type: text/plain" \
    --data-binary @app/build/outputs/mapping/release/mapping.txt

In CI, take the version name and code from the same place your build reads them, for example from environment variables that also set versionName and versionCode in build.gradle, so the values always match.

Troubleshooting

  • 401 Unauthorized: the token is missing or invalid. Use a workspace API key, not the SDK's application API key.
  • 403 Forbidden: the key has no admin permissions. Use a system API key, or a personal key of a user with the Admin role.
  • Stack traces are still obfuscated: check that the package name, version name and version code of the upload match the build in the report. Every minified build has its own mapping file, so upload it again for each build, even when only the version code changed.

The full request and response reference is in Symbols files REST API.