openatx / uiautomator2

Android Uiautomator2 Python Wrapper
MIT License
6.38k stars 1.37k forks source link

uiautomator2 运行异常 data: java.lang.NullPointerException: Attempt to read from field 'int android.accessibilityservice.AccessibilityServiceInfo.flags' on a null object reference #891

Closed xsbai3009 closed 3 months ago

xsbai3009 commented 1 year ago

手机型号:JEF-AN00 uiautomator2版本号: Name: uiautomator2 Version: 2.16.23 Summary: Python Wrapper for Google Android UiAutomator2 test tool Home-page: https://github.com/openatx/uiautomator2 Author: codeskyblue Author-email: codeskyblue@gmail.com License: MIT Location: d:\project\env\python-3.7.7_2\lib\site-packages Requires: adbutils, cached-property, Deprecated, filelock, logzero, lxml, packaging, Pillow, progress, requests, retry, six, whichcraft Required-by: weditor 相关日志: [D 230525 10:16:01 watcher:92] [pid:143280] watch check [W 230525 10:16:01 init:218] [pid:143280] atx-agent has something wrong, auto recovering [D 230525 10:16:01 init:317] [pid:143280] [xx.xx.xx.xx:xx] device xx.xx.xx.xx:xx is online [I 230525 10:16:01 init:156] uiautomator2 version: 2.16.19 [D 230525 10:16:01 init:167] Shell: ('/data/local/tmp/atx-agent', 'server', '--stop') [D 230525 10:16:01 init:296] Real version: [0, 10, 0], Expect version: [0, 10, 0] [D 230525 10:16:01 init:167] Shell: ('/data/local/tmp/atx-agent', 'server', '--nouia', '-d', '--addr', '127.0.0.1:7912') [I 230525 10:16:02 init:350] Check atx-agent version [D 230525 10:16:02 init:359] Forward: local:tcp:9087 -> remote:tcp:7912 [D 230525 10:16:02 init:359] Forward: local:tcp:9087 -> remote:tcp:7912 [D 230525 10:16:02 init:362] atx-agent version 0.10.0 [D 230525 10:16:02 init:366] device wlan ip: xx.xx.xx.xx [W 230525 10:16:02 init:488] [pid:143280] [xx.xx.xx.xx:xx] jsonrpc call got: -32001 Jsonrpc error: data: java.lang.NullPointerException: Attempt to read from field 'int android.accessibilityservice.AccessibilityServiceInfo.flags' on a null object reference at androidx.test.uiautomator.UiDevice.setCompressedLayoutHeirarchy(UiDevice.java:234) at com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:295) at com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:284) at java.lang.reflect.Method.invoke(Native Method) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.invoke(JsonRpcBasicServer.java:467) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleObject(JsonRpcBasicServer.java:352) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleJsonNodeRequest(JsonRpcBasicServer.java:283) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleRequest(JsonRpcBasicServer.java:251) at com.github.uiautomator.stub.AutomatorHttpServer.serve(AutomatorHttpServer.java:100) at fi.iki.elonen.NanoHTTPD.serve(NanoHTTPD.java:2244) at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945) at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192) at java.lang.Thread.run(Thread.java:930) , method: dumpWindowHierarchy Exception in thread Thread-1: Traceback (most recent call last): File "D:\Program Files (x86)\python3.7.7\lib\threading.py", line 926, in _bootstrap_inner self.run() File "D:\Program Files (x86)\python3.7.7\lib\threading.py", line 870, in run self._target(*self._args, *self._kwargs) File "D:\project\env\python-3.7.7_3\lib\site-packages\uiautomator2\watcher.py", line 119, in _run_forever self._run() File "D:\project\env\python-3.7.7_3\lib\site-packages\uiautomator2\watcher.py", line 93, in _run source = self._d.dump_hierarchy() File "", line 2, in dump_hierarchy File "D:\project\env\python-3.7.7_3\lib\site-packages\retry\api.py", line 74, in retry_decorator logger) File "D:\project\env\python-3.7.7_3\lib\site-packages\retry\api.py", line 33, in retry_internal return f() File "D:\project\env\python-3.7.7_3\lib\site-packages\uiautomator2\init.py", line 973, in dump_hierarchy content = self.jsonrpc.dumpWindowHierarchy(compressed, None) File "D:\project\env\python-3.7.7_3\lib\site-packages\uiautomator2\init.py", line 476, in call http_timeout) File "D:\project\env\python-3.7.7_3\lib\site-packages\uiautomator2\init__.py", line 489, in _jsonrpc_retry_call return self._jsonrpc_call(args, **kwargs) File "D:\project\env\python-3.7.7_3\lib\site-packages\uiautomator2__init__.py", line 551, in _jsonrpc_call raise err uiautomator2.exceptions.NullPointerExceptionError: -32001 Jsonrpc error: data: java.lang.NullPointerException: Attempt to read from field 'int android.accessibilityservice.AccessibilityServiceInfo.flags' on a null object reference at androidx.test.uiautomator.UiDevice.setCompressedLayoutHeirarchy(UiDevice.java:234) at com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:295) at com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:284) at java.lang.reflect.Method.invoke(Native Method) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.invoke(JsonRpcBasicServer.java:467) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleObject(JsonRpcBasicServer.java:352) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleJsonNodeRequest(JsonRpcBasicServer.java:283) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleRequest(JsonRpcBasicServer.java:251) at com.github.uiautomator.stub.AutomatorHttpServer.serve(AutomatorHttpServer.java:100) at fi.iki.elonen.NanoHTTPD.serve(NanoHTTPD.java:2244) at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945) at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192) at java.lang.Thread.run(Thread.java:930) , method: dumpWindowHierarchy

selltool commented 1 year ago

Me too

Alanyang886 commented 1 year ago

Me too

tody-yang commented 1 year ago

我也一样,可能和设备的权限有关

chrisjansky commented 12 months ago

Happens to me also, have you managed to fix it? I‘m afraid it has to do with Android version – I am running 12 but cannot figure out how to downgrade (my Redmi phone is too new).

codeskyblue commented 3 months ago

fixed