Uiautomatiorviewer connect to the machine and click to report unexpected error while observing UI hierarchy


Method 1: recommend method 2

reference resources: https://www.cnblogs.com/lucky0425/p/10955252.html

Run Android uiautomatorviewer.bat , open and connect the mobile phone. The error is as follows:

Tangled for a long time, and finally solved with the method of a great God, although I don’t understand the principle, but has solved my problem, the principle later slowly study

1. Create in the e-root directory app.png text file

2. Create in the e-root directory app.uix text file

3. Perform the following ADB naming:

                  adb shell uiautomator dump /sdcard/ app.uix

                  adb pull /sdcard/ app.uix E:/ app.uix

                  adb shell screencap -p /sdcard/ app.png

                  adb pull /sdcard/ app.pngE :/ app.png

4. Operation uiautomatorviewer.bat , import file

5. Connect the mobile phone again, you can see the screen capture page of the mobile phone, but there is only one picture, which can’t run the app completely


Method 2

reference resources: https://blog.csdn.net/qq_ 42559334/article/details/83862323

1. In the directory of installing Android SDK, find the SDK Manager.exe , click to enter



2. Select the Android version number of the real machine, check the installation package, and click Install


3. After installation, restart uiautomatorviewer.bat



Read More: