By default, New Relic Mobile enables crash reporting for your mobile applications to help track and diagnose crashes. When an Android application crashes, the agent uploads a crash report to the New Relic collector. The crash details will then be processed and de-obfuscated automatically if you are using ProGuard or DexGuard.
You can view detailed information about crashes in New Relic Mobile's Crash analysis UI, or receive crash notifications by email. You can also explore the crash data deeper with New Relic Insights, or integrate with ticketing systems for further investigation.
The Android agent for New Relic Mobile supports ProGuard and DexGuard. DexGuard is an extension to ProGuard, and it behaves the same as ProGuard when dealing with crash symbolication and obfuscated code maps.
ProGuard obfuscates your code by renaming classes, fields, and methods with semantically obscure labels. DexGuard adds another additional layer of obfuscation and security, but otherwise behaves identically to ProGuard. If ProGuard or DexGuard is enabled, the stack trace produced by a crash consists only of these obfuscated labels, which are not human-readable.
Follow the SDK installation or upgrade instructions to configure ProGuard or DexGuard and enable crash reporting. Be sure to create the
newrelic.properties file containing your application token.
New Relic Mobile uses the
mapping.txt file produced during a ProGuard/DexGuard-enabled build. This file consists of the obfuscated label names, and provides reverse mapping between obfuscated and plain text labels. You must use the copy of
mapping.txt generated during the build that produced your final application. The application's build ID changes each time an APK is generated, and the build ID in the mapping file must match the ID contained in each uploaded crash report.
After you create a
newrelic.properties file containing your New Relic app token in your project, the ProGuard or DexGuard
mapping.txt file will be uploaded automatically after each build.
- If the
mapping.txtfile is renamed using the DexGuard
-printmappingoption, the Android agent will be unable to locate or upload the stripped names.
- If you see obfuscated crash reports in the Mobile Crashes page, you may not have a
If either of these situations occur, you must manually upload the
mapping.txt replacement file.
Agent version 5.27.0 introduces changes to the way the agent plugin process maps during builds.
Maps will be reported for select variant builds
The agent will tag and report only those mapping.txt files generated by Release build-type variants. This behavior can be configured or disabled through the New Relic Gradle Plugin extension.
Variants are assigned unique build IDs
During an execution of a Gradle build, a single unique ID (build ID) was generated to represent all variants of the app built during that invocation. This often led to mismatched crash reports for customers using variants to customize a common app code base. Each variant is now identified by its own unique ID, which is used when reporting the variant's ProGuard map to New Relic. This behavior can be disabled through the New Relic Gradle Plugin extension.
Compress maps prior to upload
As apps get larger, so do their associated maps, which then results in longer upload times when reporting the map. If map reporting time is unreasonably long, the agent can compress the map prior to transfer.
To enable compressed map uploads, add the following to your app's
If you want to use another crash reporting tool, you can disable New Relic Mobile's crash reporting by calling
.withCrashReportingEnabled(false) during agent initialization. For example:
Crash reporting for Android is designed to work with other crash reporting frameworks by chaining the uncaught exception handler if it is already registered.
If no other framework has been found (or if New Relic is the first framework registered), the debug logs will include:Installing New Relic crash handler.
If another handler is already registered, debug logs will include:Installing New Relic crash handler and chaining previous exception handler.
Every time New Relic catches an exception, it is logged to
DEBUG level. For example:
A crash has been detected in <className>.
If New Relic catches an exception but crash reporting has been disabled for any reason, this message is logged:
A crash has been detected but crash reporting is disabled.
If you do not see crash reports in the New Relic Mobile user interface, check the debug logs for messages like this.
In some unusual circumstances, it may not be possible to automatically upload the ProGuard or DexGuard mapping file. This is often due to incorrectly creating a
newrelic.properties file containing your application token. This will result in build errors or warnings with detailed log messages.
To manually upload a ProGuard or DexGuard map file:
mapping.txtfile(s) in the project's build directory For example, the file is located in the
<PROJECT_ROOT>/app/build/outputs/mapping/<BUILD_VARIANT>directory for projects that use Android Studio. Generally, a
releasevariant is used when building the final version of the application. The following command is useful for finding map files:
find <project_root> -name mapping.txt
Using a command terminal, upload the ProGuard or DexGuard mapping file:
For a US account:
curl -v -F upload=@"<mapping.txt>" -H "X-APP-LICENSE-KEY:<APPLICATION_TOKEN>" https://mobile-symbol-upload.newrelic.com/symbol
For a EU account:
curl -v -F upload=@"<mapping.txt>" -H "X-APP-LICENSE-KEY:<APPLICATION_TOKEN>" https://mobile-symbol-upload.eu.newrelic.com/symbol
Replace the following in your command:
<mapping.txt>is the full path to the ProGuard or DexGuard
<APPLICATION_TOKEN>is your New Relic Mobile application token.
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's data security and licenses documentation.