Gradle & Code Quality

Sentry Android Gradle Plugin: Preserve Mapping Files for Release Reports

The Sentry Android Gradle Plugin connects build outputs such as obfuscation mappings and debug information to Sentry's release diagnostics. Adding the plugin is not enough: the uploaded symbols must match the exact build that generated the event.

By Updated 2 min read

Identify the release artifact and symbol type

Java/Kotlin obfuscation mappings, native debug symbols and source context serve different diagnostic purposes. Enable only the features appropriate for your application and review what source material is uploaded.

The official plugin repository documents supported options and compatibility. Use the documentation for your selected plugin version rather than copying an older configuration block unchanged.

Protect build credentials

Keep the Sentry upload token in an approved CI secret store or local untracked configuration. Do not embed it in the Android application or commit it with the build script. A credential needed to upload symbols belongs to the build environment, not the distributed client.

Scope and rotate the token according to the provider's current guidance.

Diagnose unreadable stack traces

Symptom Investigation
Obfuscated Java frames Matching mapping upload and release association
Native addresses without symbols Correct ABI and native debug information
Upload task failed Token scope, organization/project and network access
Some releases readable, others not CI path, variant and artifact retention differences

A successful upload for the debug variant does not prove the release mapping was uploaded.

Retain your own matching artifacts

Archive the mapping and relevant symbols with the version code, commit and package hash. Retrace can help inspect a Java/Kotlin stack locally when you have the correct mapping. Do not regenerate a mapping from a later build and apply it to an older crash.

Verify with a controlled event

Use a test release and synthetic failure to confirm that the expected frames are readable. Remove or gate the test trigger before production distribution. APKLint's build and crash tools can help review configuration and traces, but they cannot access your Sentry project or confirm that private symbol uploads completed. Keep the upload log and test-event evidence in the release record.

Sources and further reading

  1. Sentry: Android Gradle integration
  2. Android Developers: Retrace

Reference review: 22 September 2026. Examples illustrate the workflow; check your installed versions, release artifact and account-specific Console requirements before applying them. This guide is not a claim that APKLint executed your project or verified your private account.

APKLint

Android inspection tools and practical release guides. About APKLint · Report a correction