Uiautomatorviewer Error: Unexpected error while obtaining UI hierarchy java.lang.reflect.InvocationT…

1.Error report screenshot

After Android 8, the UI Automator of the SDK is opened directly, and the machine interface information cannot be intercepted.

It is recommended that you can use the following methods to intercept manually


1. Intercept the uix file

adb shell uiautomator dump /sdcard/ sc.uix

adb pull /sdcard/ sc.uix

Note: the new mobile address is changed to/data/local/TMP/*. Uix

2. Screenshot

adb shell screencap -p /sdcard/ sc.png

adb pull /sdcard/ sc.png

3. Open the uiautomatorviewer.bat , import the screenshot and resource file obtained from the machine

3、 Screenshot after solution

Read More: