uiautomaterviewer: Unexpected error while obtaining UI hierarchy java.lang.reflect.InvocationTargetException

created at 09-01-2021 views: 46

In Android 9.0 system, the following error is reported when using uiautomaterviewer+Genymotion emulator to capture elements:

Unexpected error while obtaining UI hierarchy java.lang.reflect.InvocationTargetException, as shown in the figure:

Unexpected error while obtaining UI hierarchy

Solution

Update the tools folder corresponding to the Andriod SDK to version 26

After downloading the file, decompress it, delete the tools folder in the original SDK directory, then copy the decompressed folder to the sdk directory, then start uiautomaterviewer.bat, and the capture is successful.

the capture is successful

created at:09-01-2021
edited at: 09-01-2021: