codeskyblue / uiautodev

Mobile UI viewer in browser, view the UI in a tree view, and generate XPath automatically.
https://uiauto.dev
MIT License
107 stars 19 forks source link

500 Internal Server Error #17

Open Planetinaline opened 2 months ago

Planetinaline commented 2 months ago

Hi, i'm greenhand in terms of app developing and encountered a problem which i couldn't solve. Note that i've tried turning off the proxy or enabling it both on my phone and PC, but still get Internet error. here's the terminal snap: (weditor) chenyu@cy:~/Desktop$ uiauto.dev uiautodev version: 0.5.0 INFO: Started server process [5891] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:20242 (Press CTRL+C to quit) INFO: 127.0.0.1:44432 - "GET / HTTP/1.1" 307 Temporary Redirect INFO: 127.0.0.1:44444 - "GET /api/info HTTP/1.1" 200 OK INFO: 127.0.0.1:44444 - "GET /api/android/list HTTP/1.1" 200 OK unexpected dump error: ('Unknown RPC error: -32001 java.lang.NullPointerException', (False, 50), "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)'\n\tat androidx.test.uiautomator.UiDevice.setCompressedLayoutHeirarchy(UiDevice.java:234)\n\tat com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:295)\n\tat com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:284)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat com.googlecode.jsonrpc4j.JsonRpcBasicServer.invoke(JsonRpcBasicServer.java:467)\n\tat com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleObject(JsonRpcBasicServer.java:352)\n\tat com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleJsonNodeRequest(JsonRpcBasicServer.java:283)\n\tat com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleRequest(JsonRpcBasicServer.java:251)\n\tat com.github.uiautomator.stub.AutomatorHttpServer.serve(AutomatorHttpServer.java:100)\n\tat fi.iki.elonen.NanoHTTPD.serve(NanoHTTPD.java:2244)\n\tat fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945)\n\tat fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)\n\tat java.lang.Thread.run(Thread.java:1012)\n") Traceback (most recent call last): File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautodev/driver/android.py", line 72, in _dump_hierarchy_raw return self.ud.dump_hierarchy() File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautomator2/init.py", line 284, in dump_hierarchy content = self._do_dump_hierarchy(compressed, max_depth) File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/decorator.py", line 232, in fun return caller(func, *(extras + args), kw) File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/retry/api.py", line 73, in retry_decorator return retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter, File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/retry/api.py", line 33, in retry_internal return f() File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautomator2/init.py", line 299, in _do_dump_hierarchy content = self.jsonrpc.dumpWindowHierarchy(compressed, max_depth) File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautomator2/init.py", line 185, in call return self.server.jsonrpc_call(self.method, params, http_timeout) File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautomator2/core.py", line 268, in jsonrpc_call return _jsonrpc_call(self._dev, method, params, timeout, self._debug) File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautomator2/core.py", line 151, in _jsonrpc_call raise RPCUnknownError(f"Unknown RPC error: {code} {message}", params, stacktrace) uiautomator2.exceptions.RPCUnknownError: ('Unknown RPC error: -32001 java.lang.NullPointerException', (False, 50), "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)'\n\tat androidx.test.uiautomator.UiDevice.setCompressedLayoutHeirarchy(UiDevice.java:234)\n\tat com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:295)\n\tat com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:284)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat com.googlecode.jsonrpc4j.JsonRpcBasicServer.invoke(JsonRpcBasicServer.java:467)\n\tat com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleObject(JsonRpcBasicServer.java:352)\n\tat com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleJsonNodeRequest(JsonRpcBasicServer.java:283)\n\tat com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleRequest(JsonRpcBasicServer.java:251)\n\tat com.github.uiautomator.stub.AutomatorHttpServer.serve(AutomatorHttpServer.java:100)\n\tat fi.iki.elonen.NanoHTTPD.serve(NanoHTTPD.java:2244)\n\tat fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945)\n\tat fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)\n\tat java.lang.Thread.run(Thread.java:1012)\n") dump_hierarchy failed Traceback (most recent call last): File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautodev/driver/android.py", line 72, in _dump_hierarchy_raw return self.ud.dump_hierarchy() File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautomator2/init.py", line 284, in dump_hierarchy content = self._do_dump_hierarchy(compressed, max_depth) File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/decorator.py", line 232, in fun return caller(func, *(extras + args), kw) File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/retry/api.py", line 73, in retry_decorator return retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter, File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/retry/api.py", line 33, in retry_internal return f() File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautomator2/init.py", line 299, in _do_dump_hierarchy content = self.jsonrpc.dumpWindowHierarchy(compressed, max_depth) File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautomator2/init.py", line 185, in call return self.server.jsonrpc_call(self.method, params, http_timeout) File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautomator2/core.py", line 268, in jsonrpc_call return _jsonrpc_call(self._dev, method, params, timeout, self._debug) File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautomator2/core.py", line 151, in _jsonrpc_call raise RPCUnknownError(f"Unknown RPC error: {code} {message}", params, stacktrace) uiautomator2.exceptions.RPCUnknownError: ('Unknown RPC error: -32001 java.lang.NullPointerException', (False, 50), "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)'\n\tat androidx.test.uiautomator.UiDevice.setCompressedLayoutHeirarchy(UiDevice.java:234)\n\tat com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:295)\n\tat com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:284)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat com.googlecode.jsonrpc4j.JsonRpcBasicServer.invoke(JsonRpcBasicServer.java:467)\n\tat com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleObject(JsonRpcBasicServer.java:352)\n\tat com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleJsonNodeRequest(JsonRpcBasicServer.java:283)\n\tat com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleRequest(JsonRpcBasicServer.java:251)\n\tat com.github.uiautomator.stub.AutomatorHttpServer.serve(AutomatorHttpServer.java:100)\n\tat fi.iki.elonen.NanoHTTPD.serve(NanoHTTPD.java:2244)\n\tat fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945)\n\tat fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)\n\tat java.lang.Thread.run(Thread.java:1012)\n")

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautodev/router/device.py", line 75, in dump_hierarchy xml_data, hierarchy = driver.dump_hierarchy() File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautodev/driver/android.py", line 55, in dump_hierarchy xml_data = self._dump_hierarchy_raw() File "/home/chenyu/miniconda3/envs/weditor/lib/python3.9/site-packages/uiautodev/driver/android.py", line 75, in _dump_hierarchy_raw raise AndroidDriverException("Failed to dump hierarchy") uiautodev.exceptions.AndroidDriverException: Failed to dump hierarchy INFO: 127.0.0.1:44456 - "GET /api/android/R5CTA1AWTVB/hierarchy HTTP/1.1" 500 Internal Server Error

Planetinaline commented 2 months ago

problem solved it's due to the ATX-agent didn't properly activate.

codeskyblue commented 2 months ago

please update uiautomator2 to 3.2.2 . The issue will be resolved.