3.8 KiB
title, description, keywords, author, ms.author, ms.date, ms.topic, ms.assetid, ms.service, ms.custom
| title | description | keywords | author | ms.author | ms.date | ms.topic | ms.assetid | ms.service | ms.custom |
|---|---|---|---|---|---|---|---|---|---|
| Android Deobfuscation | Learn how to deobfuscate your crash reports with ProGuard enabled | crashes, errors, Android, obfuscate | lucen-ms | lucen | 11/11/2019 | article | 2f91bc0e-686c-428a-8cda-2a48b0811a6e | vs-appcenter | analytics |
Android Deobfuscation
[!INCLUDE Retirement announcement for App Center]
ProGuard, DexGuard and R8 are tools to optimize and obfuscate the code of Android apps. It removes unused code, renames classes, fields, and methods with semantically obscure names, making the code base smaller and harder to reverse engineer. To enable obfuscation with ProGuard or R8 in your Android app, follow the official Android Developer documentation.
With ProGuard, DexGuard or R8 enabled in your Android app, your stack traces must be deobfuscated. App Center automatically deobfuscates stack traces for your Java, Kotlin, and React Native Android apps when you upload the mapping.txt file created on each build. This file maps the original class, method, and field names to the obfuscated names making the stack traces readable.
The App Center Build and Distribution service can automatically generate mapping files and upload them to the Diagnostics service. If you use App Center to build and auto distribute your app to your end users, you don't need to manually obtain and upload the mapping files as detailed in the steps below.
Uploading the mapping.txt file
App Center Portal
- Download the
mapping.txtfile from your app module's build directory - Log into App Center and select your app
- In the left menu, navigate to the Diagnostics section
- Select Mappings
- Click the Upload mappings button in the upper right
- Fill in the Version Name and Version Code (these must match that build's Gradle configuration in order for the mapping to work for a particular build)
- Upload the
mapping.txtfile from your app module's build directory. - Click the Save button.
App Center API
The process for uploading mapping files through the API involves a series of three API calls: one to allocate space on our backend, one to upload the file, and one to update the status of the upload. The body of the first API call should set symbol_type to AndroidProguard, build and version properties that correspond to the Version Code and Version Name, respectively, as well as a file_name.
[!INCLUDE symbol upload api]
App Center CLI
You can also use the CLI to upload mapping files:
appcenter crashes upload-mappings --mapping {mapping file} --version-name {version name} --version-code {version code}
Note
App Center can't check if you've uploaded the right
mapping.txtfile. We recommend uploading the file directly after you create the .apk file, or push it to your code repository if you want to upload it later.
Forwarding the mapping from a build in App Center
If a build is configured to produce a mapping.txt file, App Center builds produce the file as an available download. Automatically distributing the build or manually distributing it later will forward the mapping.txt file onto Diagnostics to deobfuscate incoming crash reports. It isn't needed to manually upload the mapping.txt file after distributing a build.
Deleting a mapping file
- Make a
GETrequest to the symbols_list API. This retrieves the IDs for the mapping files you uploaded. - Make a
DELETErequest to the symbols_upload API with the mapping file ID. This deletes the specified mapping file.