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 tool window. By default, the tab is activated automatically every time an application is deployed and launched successfully.
The logcat
functionality is also available
from the Debug tool window. The only difference is that while the
Logcat tab in the Debug tool window shows a log of all processes,
in the Android tool window you can filter log messages by a specific
process.
When logcat is attached to a device, it keeps auto-scrolling you to the bottom of the log. If you want to stop the automatic scroll, start scrolling the log with your mouse.
On this page:
- Switching the Logcat functionality on and off
- Showing and hiding the Logcat tab
- Defining the scope of log data to display
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 Logcat tab and clear the Show logcat automatically check box.
During a debug session, you can switch to the Android 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 tool window.