You can report native crashes caused by native Android libraries. This feature is available for all architectures supporting the Android Native Development Kit (NDK).
Native Crash Handler
When instrumentation is initialized, the native crash handler loads the AppDynamics library
libadeum. At entry points of your code, a signal handler is injected into the running process. After a signal is handled,
libadeum restores the previous signal handler. (This enables you to use different methods to handle signals.)
The handler collects and writes the information about the native crash into a temporary file. When the application is restarted, the temporary file is read, processed, and the crash information is displayed in the Controller UI.
Configuration for Native Crash Reporting
By default, however, this feature is turned off, so you need to add the section
nativeCrashHandling and set
enabled to true. In addition, you point the library paths in the
variantLibraryPaths array for each build variant to write the symbol files locally and transmit the symbol files to the EUM Server. You can also specify a build ID for a project build. After you build the project, the build ID can be found in
build/appDynamics/ndkSym<VariantName>/<AppBuildID>. If not specified, the build ID of the most recently built project will be used.
// Other configuration if needed.
// Enable native crash handling; the default is false.
enabled = true
buildId = "<your_custom_build_id>"
variantLibraryPaths = ["release": "ndkLib/obj/local", "debug": "ndkLib/obj/debug", ...]
Configuration for the Android App Bundle
If you using Android App Bundle, you need to add the following line to your app module
build.gradle for crashes to symbolicate correctly.
View Source Code Information in the Stack Trace
You have two different ways to view symbol information in the stack trace:
- From the Crash Details dialog, download the crash report and use a utility like
ndk-stackto view the crash report with source code level symbolications.
Upload the symbol files and then view the stack trace in the Crash Details dialog.
Download the Crash Report and Use ndk-stack
- From the Crash Dashboard, double-click one of the crashes listed in the Unique Crashes widget.
- From the Crash Details dialog, click Download to download the crash report.
- Run ndk-stack (or a similar utility) on the downloaded crash report as the input file to generate a crash report with source code level symbolications.
Upload the Symbol File and View the Stack Trace
You are recommended to automatically generate and upload symbol files, but you can also manually generate and upload the symbol files, too. After you upload the symbol files, when the app with the same build ID as the UUID of the uploaded
ndkSYM file crashes, you will see the file name and the line number next to the C/C++ function name for each frame of the stack trace shown in the Crash Details dialog.
Automatically Generate and Upload Symbol Files
You can run the following
gradle command to generate and upload the symbol files to the EUM Server. Replace
<VariantName> with the build variant names you defined in the configuration. For example, in the configuration above, the
<VariantName> could be release or debug.
$ gradle appDynamicsUploadNDKSymbolFile<VariantName>
Manually Generate and Upload Symbol Files
To generate symbol files, run the following gradle command, where
<VariantName> is the build variant names. The generated symbol file will be written to
$ gradle appDynamicsGenerateNDKSymbolFile<VariantName>
To manually upload the generated symbol file, use the following cURL command, replacing the
<ndkSymZipFile> with your generated symbol file,
<Account Name> with your EUM Account name, and
<License Key> with your EUM License Key.
$ curl -v -H Content-Type:application/octet-stream --upload-file <ndkSymZipFile> --user <Account Name>:<License Key> https://api.eum-appdynamics.com/v2/account/<Account Name>/android-ndksym