uiautomatorviewer解析UI层次结构XML文件时出错:无效的ui automator层次结构文件

时间:2016-12-01 07:47:42

标签: uiautomatorviewer

我可以捕获应用程序的一个屏幕,其他屏幕也很好。

gui说:解析UI层次结构XML文件时出错:无效的ui automator层次结构文件。 解析UI层次结构XML文件时出错:无效的ui automator层次结构文件。

并且终端的日志是:

org.xml.sax.SAXParseException; systemId: file:/var/folders/vs/30nqjbc16kd21g3hc_5h7vg40000gn/T/uiautomatorviewer_1759068495088939262/dump_421507564099289174.uix; lineNumber: 1; columnNumber: 1; Premature end of file.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
    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:400)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1437)
    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:643)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:328)
    at com.android.uiautomator.tree.UiHierarchyXmlLoader.parseXml(UiHierarchyXmlLoader.java:130)
    at com.android.uiautomator.UiAutomatorModel.<init>(UiAutomatorModel.java:51)
    at com.android.uiautomator.UiAutomatorHelper.takeSnapshot(UiAutomatorHelper.java:155)
    at com.android.uiautomator.actions.ScreenshotAction$1.run(ScreenshotAction.java:91)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
null rootnode after parsing.

更新: 我换了手机,现在一切都还好......

1 个答案:

答案 0 :(得分:0)

如果您使用的是Android 7.1.1或更高版本,则必须在移动设备的开发者选项中配置某些内容

1. Turn on USB DEBUGGING 2. Enable view attribute inspection 3. Select the debug app option and choose com.github.uiautomator