Error obtaining UI hierarchy: Error while parsing UI hierarchy XML file: Invalid ui automator hierarchy file

While capturing the google map screenshot through uiautomatorviewer, I am getting this error.


org.xml.sax.SAXParseException; systemId: file:/var/folders/3m/hcxz23qj2j363m_2w2f_vnjw0000gn/T/uiautomatorviewer_8555561665430051096/dump_260380664560766323.uix; lineNumber: 1; columnNumber: 1; Premature end of file. at at at at at at$ at at at at at at at$JAXPSAXParser.parse( at at javax.xml.parsers.SAXParser.parse( at at at at$ at org.eclipse.jface.operation.ModalContext$ null rootnode after parsing.strong


I found the answer to this issue.

  1. Open Android folder by cmd prompt
  2. adb shell uiautomator dump
  3. adb pull /sdcard/window_dump.xml ui.uix
  4. adb shell screencap -p /sdcard/ui.png
  5. adb pull /sdcard/ui.png
  6. open uiautomaterviewer
  7. Open folder to select dump files
    A. Screenshot:
    B. UI XML Dump:

Swapna_Das hope you are fine. Could you please share how you build a parser to create GUI hierarchy from UIAutommater?
i am very thankful to you.