Using uiautomatorviewer plug-in in Android Studio

1.Overview

Android Studio is an integrated development environment (IDE) officially provided by Google for developing Android applications . It is developed based on IntelliJ IDEA and provides developers with a complete tool chain, including code writing, debugging, testing, and performance. Optimization etc.

The Android Studio integrated development environment has the following features:

Provides a powerful layout editor : Android Studio provides a powerful layout editor that can quickly create the user interface of the application by dragging and placing controls.

Integrated Android SDK and support libraries : Android Studio comes with Android SDK and support libraries, which can be easily managed and updated.

There is a plug-in in the SDK that can view the APP UI - uiautomatorviewer.bat

This plug-in is separated into UI Automator Viewer (interface automation viewer), which is a supporting tool of Android's UI Automator testing framework (Ui automation framework). This tool can view control information on the current device screen.

2.Tool installation

After opening Android Studio, find the Android SDK option under Tools ->SDK Manager.

Then select SDK Tools, uncheck Hide Obsolete Packages, Android SDK Tools (Obsolete) appears, select Apply.

After waiting for the installation to complete, you can find uiautomatorviewer.bat in the SDK installation path. Double-click it to view the control information of the current Android device.

 

3.Tool usage

After double-clicking to open uiautomatorviewer.bat, connect to the Android device. There are four functional areas in the upper left corner:

1. The first icon can open a locally saved View tree file.

2. The second icon obtains the detailed control hierarchy information of the current screen. When the controls on the device screen change, click once to re-obtain the current control information.

3. The third icon obtains the compressed View tree information of the current screen.

4. The fourth icon saves the control hierarchy of the current screen as a file. This file can be opened again through the first icon through this tool.

 

When you click a control, the detailed information of the control will be displayed, or click the View tree display area on the right to display the corresponding control on the screen.

In the detailed information on the lower right side, we focus on three columns:

1、resource-id

Corresponding to the id attribute in the layout file, such as the displayed org.codeaurora.snapcam:id/mode_text, the rule for displaying information is: packageName:id/xxx!

2、class

Indicates which class the control object is created with. The selected control type is android.widget.TextView, which is the actual type of the control.

3、package

Indicates the package name of the application where the control is located. The selected control is a control on the camera, so the package value is org.codeaurora.snapcam, which is the package name of the camera app.

As above, you can complete the basic use of uiautomatorviewer.bat, and you can quickly and easily obtain the control information of the current device!

Using uiautomatorviewer plug-in in Android Studio

For more technical articles, the first public account " Moyu IT " on the entire network will be locked - 11 a.m. -. I hope everyone will pay attention, forward and like!

Guess you like

Origin blog.csdn.net/qrx941017/article/details/132335302