How To: Export a crash log (logcat) from an Android device
When using Esri products for the Android mobile platform and the application crashes, the generated log files (logcat) can be retrieved to perform diagnostics and troubleshooting. However, as not all of these products have Developer mode enabled by default, the log files can only be retrieved using the Android SDK Platform-Tools.
Note: Some Esri apps offer troubleshooting logs that can be obtained from the app that can help with troubleshooting errors (see the screenshots below from Field Maps as an example). This article explains the workflow to export device logs, not logs specifically from a certain app.
The following workflow can be performed for non-rooted Android devices to extract the log files. However, prior to reproducing the error to generate and extract the log file, Developer mode must be activated on the Android device. A computer is required to perform the extraction.
Warning: This workflow involves using Android SDK Platform-Tools and is not supported by Esri.
- On the Android device, navigate to Settings > About device, and tap the Build Number option seven times to enable developer mode.
Note: On some Android devices, the Build Number option can be accessed via Settings > About phone > Software information.
- Navigate back to the Settings menu > System > Advanced, and open Developer options, and enable the USB debugging option.
- For Android devices running on versions 5.0 or later, increase the Logger buffer sizes to 4 MB per log buffer.
Note: 4MB is sufficient for storing the logs. However, this can be increased as needed.
- Open the mobile application and reproduce the error. This generates the log file.
- Connect the Android device to a computer with a USB cable. You may get a prompt on your device to allow access to phone data.
- Create a folder on your computer to store the logs in, for example, C:\AndroidLog.
- Download Android SDK Platform Tools, and extract the contents to the computer.
- Open the extracted platform-tools folder and ensure adb.exe exists.
- Press Ctrl + Shift , right-click the empty workspace area, and select Open command window here, or Open PowerShell window here.
- In Windows 10, you may not have the option to Open command window here when pressing Ctrl + Shift and right-clicking. You have the option to use PowerShell instead.
- If for any reason you need to use the Windows Command Prompt, you can go to the Taskbar settings and disable the option to replace Command Prompt with Windows PowerShell.
- You can open a Command Prompt as admin by right-clicking the Windows Start menu.
- In the command prompt/PowerShell, perform the following command:
- Change the output path in the sample code below to the folder you created in step 6.
- Specify a name for a text file to export the logs (with .txt extension).
adb logcat -v threadtime -d > C:\AndroidLog\logcat.txt
Note: If the command failed with an error like this: "adb : The term 'adb' is not recognized as the name of a cmdlet, function, script file, or operable program.", try running the same command with ".\adb" instead of "adb", as follows.
.\adb logcat -v threadtime -d > C:\AndroidLog\logcat.txt
Note: When the export process is started, you may get a prompt on your phone to allow USB debugging. You must click OK to allow debugging.
- The log file (logcat.txt) is now extracted to the destination folder using verbose logging.
Note: For more information on understanding the log file, refer to Reading Bug Reports.
Last Published: 11/1/2021
Article ID: 000017058
Software: ArcGIS Runtime SDK for Android 2.0, 100.9, 100.8, 100.7, 100.6, 100.5, 100.4, 100.3, 100.2.1, 100.2.0, 100.12, 100.11, 100.10, 100.1.0, 100.0.0, 10.2.9, 10.2.8.1, 10.2.8, 10.2.7, 10.2.6, 10.2.5, 10.2.4, 10.2.3, 10.2.2, 10.2, 10.1.1, 1.1.1, 1.0.1