Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dump hierachy fail #823

Open
DavinShire opened this issue Aug 4, 2022 · 5 comments
Open

dump hierachy fail #823

DavinShire opened this issue Aug 4, 2022 · 5 comments

Comments

@DavinShire
Copy link

[E 220804 17:50:24 web:2243] 500 GET /api/v1/devices/android%3A/hierarchy (::1) 30.92ms
[I 220804 17:50:47 web:2243] 200 POST /api/v1/connect (::1) 4974.64ms
[I 220804 17:50:49 web:2243] 200 POST /api/v1/connect (::1) 2286.09ms
[I 220804 17:50:52 web:2243] 200 POST /api/v1/connect (::1) 2298.34ms
[I 220804 17:50:54 web:2243] 200 POST /api/v1/connect (::1) 4641.20ms
[I 220804 17:50:56 web:2243] 200 POST /api/v1/connect (::1) 6935.56ms
[I 220804 17:50:59 web:2243] 200 POST /api/v1/connect (::1) 9238.08ms
[I 220804 17:50:59 web:2243] 304 GET /static/loading.svg (::1) 9251.85ms
[I 220804 17:50:59 page:176] Serial: android:R3CR70WHH9H
[I 220804 17:50:59 web:2243] 200 GET /api/v1/devices/android%3AR3CR70WHH9H/screenshot (::1) 347.07ms
[W 220804 17:50:59 init:493] [pid:3988] jsonrpc call got: -32001 Jsonrpc error: <java.lang.NullPointerException> 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:920)
, method: dumpWindowHierarchy
[E 220804 17:50:59 web:1793] Uncaught exception GET /api/v1/devices/android%3AR3CR70WHH9H/hierarchy (::1)
HTTPServerRequest(protocol='http', host='localhost:17310', method='GET', uri='/api/v1/devices/android%3AR3CR70WHH9H/hierarchy', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "C:\Python37\lib\site-packages\tornado\web.py", line 1702, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "C:\Python37\lib\site-packages\weditor\web\handlers\page.py", line 171, in get
self.write(d.dump_hierarchy())
File "C:\Python37\lib\site-packages\weditor\web\device.py", line 17, in dump_hierarchy
return uidumplib.get_android_hierarchy(self.d)
File "C:\Python37\lib\site-packages\weditor\web\uidumplib.py", line 107, in get_android_hierarchy
page_xml = d.dump_hierarchy(compressed=False, pretty=False).encode('utf-8')
File "", line 2, in dump_hierarchy
File "C:\Python37\lib\site-packages\retry\api.py", line 74, in retry_decorator
logger)
File "C:\Python37\lib\site-packages\retry\api.py", line 33, in retry_internal
return f()
File "C:\Python37\lib\site-packages\uiautomator2_init
.py", line 966, in dump_hierarchy
content = self.jsonrpc.dumpWindowHierarchy(compressed, None)
File "C:\Python37\lib\site-packages\uiautomator2_init
.py", line 481, in call
http_timeout)
File "C:\Python37\lib\site-packages\uiautomator2_init.py", line 494, in _jsonrpc_retry_call
return self.jsonrpc_call(*args, **kwargs)
File "C:\Python37\lib\site-packages\uiautomator2_init
.py", line 556, in _jsonrpc_call
raise err
uiautomator2.exceptions.NullPointerExceptionError: -32001 Jsonrpc error: <java.lang.NullPointerException> 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:920)
, method: dumpWindowHierarchy
[E 220804 17:50:59 web:2243] 500 GET /api/v1/devices/android%3AR3CR70WHH9H/hierarchy (::1) 26.93ms

I tried to clear google chrome cache but still not work , please fix it , thank you

@alx-xlx
Copy link

alx-xlx commented Aug 18, 2022

I am also getting similar issues

	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:920)
, method: sleep

@Sanmejie
Copy link

10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: 2023-01-15 22:47:46.359 | ERROR | main:check_player_state:256 - 获取xml失败:-32001 Jsonrpc error: <java.lang.NullPointerException> data: java.lang.NullPointerException: Attempt to read from field 'int android.accessibilityservice.AccessibilityServiceInfo.flags' on a null object reference in method 'void androidx.test.uiautomator.UiDevice.setCompressedLayoutHeirarchy(boolean)'
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: at androidx.test.uiautomator.UiDevice.setCompressedLayoutHeirarchy(UiDevice.java:234)
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: at com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:295)
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: at com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:284)
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: at java.lang.reflect.Method.invoke(Native Method)
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: at com.googlecode.jsonrpc4j.JsonRpcBasicServer.invoke(JsonRpcBasicServer.java:467)
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleObject(JsonRpcBasicServer.java:352)
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleJsonNodeRequest(JsonRpcBasicServer.java:283)
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleRequest(JsonRpcBasicServer.java:251)
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: at com.github.uiautomator.stub.AutomatorHttpServer.serve(AutomatorHttpServer.java:100)
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: at fi.iki.elonen.NanoHTTPD.serve(NanoHTTPD.java:2244)
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945)
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: at java.lang.Thread.run(Thread.java:1012)
10|cb_040b_player_serial | 2023-01-15 22:47 +08:00: , method: dumpWindowHierarchy

@Kardelio
Copy link
Contributor

Kardelio commented Feb 7, 2023

same here! ^ any ideas on this anyone?

@Kardelio
Copy link
Contributor

Kardelio commented Feb 7, 2023

I found that if you delete the folder that is created in the home directory called ~/.uiautomator2 with:
rm -rf ~/.uiautomator2 and then re try the dump it works after that....

Its not a great solution as it has to re-run all the setup and takes time, but maybe this is something that helps someone else understand the actual issue or at least where to start looking...

Kardelio added a commit to Kardelio/uiautomator2 that referenced this issue Feb 9, 2023
Forces a reset when NPE exception happens.
@Kardelio
Copy link
Contributor

Kardelio commented Feb 9, 2023

@DavinShire @Sanmejie @alx-xlx
I've just pushed a potential fix for this.
I tested it over on my machine after repeatedly getting the error and now the problem resolves itself by force reseting the uiautomator.

Let me know what you think

codeskyblue pushed a commit that referenced this issue Mar 16, 2023
Forces a reset when NPE exception happens.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants