uiautomatorviewer 定位元素时总是报.Error while parsing UI hierarchy XML file: Invalid ui automator hierarchy file.
定位某个界面元素才出现这个错,其他页面可正常获取
查看 C:\Users\Administrator\AppData\Local\Temp\uiautomatorviewer_6741492611496796841 目录下生成的 dump_1051247796670000085.uix 文件为空,png 截图文件无法查看
控制台上输出如下信息
org.xml.sax.SAXParseException; systemId: file:/C:/Users/ADMINI~1/AppData/Local/Temp/uiautomatorviewer_6741492611496796841/dump_1051247796670000085.uix; lineNumber: 1; columnNumber: 1; 文件提前结束。
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1019)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:328)
at com.android.uiautomator.tree.UiHierarchyXmlLoader.parseXml(UiHierarchyXmlLoader.java:128)
at com.android.uiautomator.UiAutomatorModel.<init>(UiAutomatorModel.java:42)
at com.android.uiautomator.UiAutomatorHelper.takeSnapshot(UiAutomatorHelper.java:142)
at com.android.uiautomator.actions.ScreenshotAction$1.run(ScreenshotAction.java:85)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
null rootnode after parsing.
之前成功获取截图一次,后来就一直报这个错,试过卸载重装 app 都不起作用。