0

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

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.

更新:我换了一个手机,现在一切正常..

4

1 回答 1

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

于 2017-11-09T20:46:22.837 回答