Debugging with Logcat
In IntelliJ IDEA, debugging of Android applications is provided through the support of the logcat functionality that stores a log of system debug output. Log messages include a stack trace when the emulator throws an error, so you can navigate to the exception location in the source code.
The logcat functionality is handled by the Android Debug Bridge (adb). This service supports interaction between your development environment, Android devices, emulators and other tools, for example, DDMS.
If various tools that use ADB are launched simultaneously, they may conflict with each other, so it is recommended to disable the logcat functionality before switching from IntelliJ IDEA to an ADB-managed tool.
In IntelliJ IDEA, the logcat functionality is available through the Logcat tab of the Android Monitor tool window. By default, the tab is activated automatically every time an application is deployed and launched successfully.
On this page:
- Switching the Logcat functionality on and off
- Showing and hiding the Logcat tab
- Defining the scope of log data to display
Switching the Logcat functionality on and off
To enable/disable logcat, in the main menu navigate to Tools | Android and toggle the Enable ADB Integration option.
Showing and hiding the Logcat tab
By default, the Logcat tab is activated automatically every time an application is deployed and launched successfully. You can disable automatic display of the Logcat pane by performing the following steps:
Start creating an Android run/debug configuration or open an existing configuration for editing (in the main menu, navigate to Run | Edit Configurations and select the required configuration).
Switch to the Miscellaneous tab and clear the Show logcat automatically checkbox.
Defining the scope of log data to display
During a debug session, you can switch to the Android Monitor tool window and configure the scope of log data to be displayed. You can:
Select to only see messages related to a specific process.
Define a log level for messages to be displayed.
Create log data filter configurations.
For detailed instructions on how to configure these options, refer to Android Monitor tool window.