본문 바로가기
User Guide

Android Monitor Basics (46)

by 각종 잡상식 지식 모음 2016. 6. 10.
반응형

Android Monitor Basics

Android Monitor has a main window that contains the logcat, Memory, CPU, GPU, and Network Monitors. From this window, you can select a device and app process to work with, terminate an app, collect dumpsyssystem information, and create screenshots and videos of the running app.

Prerequisites and Dependencies


Before you start using Android Monitor, you need to set up your environment, as well as the hardware device or emulator. All of the monitors require the following:

  • If you want to run your app on a hardware device (as opposed to the emulator), connect it to the USB port. Make sure your development computer detects your device, which often happens automatically when you connect it.
  • Enable ADB integration by selecting Tools > Android > Enable ADB IntegrationEnable ADB Integrationshould have a check mark next to it in the menu to indicate it's enabled.
  • Android Device Monitor can’t be running.

All but the logcat Monitor have these additional requirements:

  • Enable USB debugging in Developer Options on the device or emulator.
  • In your app, set the debuggable property to true in the manifest or build.gradle file (it’s initially set by default).

The GPU Monitor has this requirement as well:

  • For Android 5.0 (API level 21) and Android 5.1 (API level 22), in Developer Options on the device or emulator, set Profile GPU rendering to In adb shell dumpsys gfxinfo.

The Network Monitor and the Video Capture tool work with a hardware device only, not the emulator.

Displaying Android Monitor


Android Monitor is integrated into the Android Studio main window:

  • To display Android Monitor, click Android Monitor icon, which by default is at the bottom of the main window.
  • To hide Android Monitor, click Android Monitor icon again.
  • Or select View > Tool Windows > Android Monitor.

Note: If you don't see the sidebar buttons, you can display them by selecting View > Tool Buttons.

Android Monitor looks like the following figure:

Profiling a Running App in Android Monitor


After you've met the prerequisites and optionally connected a hardware device, you're ready to profile an app in Android Monitor:

  1. Open an app project and run the app on a device or emulator.
  2. Display Android Monitor and click the tab for the monitor you want to view.
  3. Follow the instructions about using the monitor:

Switching between Devices and Apps


By default, Android Monitor displays data for your most recently run app. You can switch to another device and app as needed. In addition to currently running apps, you can view information about apps that are no longer running so you can continue to see any information about them that you gathered previously.

At the top of the Android Monitor main window are two menus listing devices and processes. To switch to another device, process, or both:

  1. Select the device or emulator.
  2. The Device menu lists the devices and emulators that are running or have run during your current session. There are various status messages that can appear in the Device menu:

    • DISCONNECTED - You closed an emulator or unplugged a device from the computer.
    • UNAUTHORIZED - A device needs you to accept the incoming computer connection. For example, if the connected device displays an Allow USB Debugging dialog, click OK to allow the connection.
    • OFFLINE - Android Monitor can’t communicate with a device, even though it has detected that device.
  3. Select the process.
  4. The Process menu lists the processes that are running or have run during your current session. If a process is no longer running, the menu displays a status of DEAD.

Rearranging Android Monitor Windows


You can rearrange the Android Monitor windows for optimal viewing during your tests:

  • To move a monitor up or down, click Move Monitor Up Move Monitor Up icon or Move Monitor Down Move Monitor Down icon.
  • To minimize or maximize a monitor, click Minimize Monitor Minimize Monitor icon or Maximize Monitor Maximize Monitor icon.

To rearrange the logcat and Monitors tabs:

  • To reorder the logcat or monitor group, move the tabs back and forth.
  • To move the logcat or monitor group to a standalone window, drag a tab to a different location on the screen. Or, select Gear menu icon > Floating Mode.
  • To dock a standalone window, drag it to the Android Monitor tab area.
  • To combine the logcat and monitor group displays together, drag a tab and move it onto another monitor.
  • To hide a tab, click the Hide icon icon. To make it reappear, click Restore Monitors View Restore Monitors View icon or the Restore logcat View Restore logcat View icon on the far right of the row of tabs.

Terminating an App


To stop an app you’ve run from Android Studio:

  1. Select the device and the process in the Android Monitor menus, if needed.
  2. Click Terminate Application Terminate App icon.
  3. The process status changes to DEAD in the Processes menu. The emulator or device continues to run, but the app closes. Any running monitors in Android Monitor stop.

Removing an App from a Device


To remove an app from a device you use for development, use the normal uninstall procedure on the device.

If you run a new version of an app from Android Studio that’s been already installed on a hardware device, the device displays an Application Installation Failed dialog. Click OK to install the new version of the app.

Using Other Main Window Features


From the Android Monitor main window, you can also do the following:

반응형

'User Guide' 카테고리의 다른 글

Investigating Your RAM Usage (48)  (0) 2016.06.10
Memory Monitor (47)  (0) 2016.06.10
Android Monitor Overview (45)  (0) 2016.06.10
Performance Profiling Tools (44)  (0) 2016.06.10
MonkeyRunner (43)  (0) 2016.06.10

댓글