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

多设备操作时提示:UiAutomationNotConnectedError: ({'code': -32001, 'message': 'java.lang.IllegalStateException', 'data': 'java.lang.IllegalStateException: U #932

Closed
jacket230 opened this issue Jan 12, 2024 · 3 comments

Comments

@jacket230
Copy link

用一台电脑,操作两台设备的时候,出现这种错误。如何解决?
uiautomator2.exceptions.UiAutomationNotConnectedError: ({'code': -32001, 'message': 'java.lang.IllegalStateException', 'data': 'java.lang.IllegalStateException: UiAutomation not connected!\n\tat android.app.UiAutomation.throwIfNotConnectedLocked(UiAutomation.java:1034)\n\tat android.app.UiAutomation.injectInputEvent(UiAutomation.java:494)\n\tat androidx.test.uiautomator.InteractionController.injectEventSync(InteractionController.java:690)\n\tat androidx.test.uiautomator.InteractionController.touchDown(InteractionController.java:351)\n\tat androidx.test.uiautomator.InteractionController.swipe(InteractionController.java:487)\n\tat androidx.test.uiautomator.InteractionController.swipe(InteractionController.java:460)\n\tat androidx.test.uiautomator.UiDevice.swipe(UiDevice.java:575)\n\tat com.github.uiautomator.stub.AutomatorServiceImpl.swipe(AutomatorServiceImpl.java:247)\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:761)\n'}, 'swipe')

@codeskyblue
Copy link
Member

Use multiprocess is recommend

@jacket230
Copy link
Author

Use multiprocess is recommend

yes ,i use multiprocess ,but error .
uiautomator2.exceptions.UiAutomationNotConnectedError: ({'code': -32001, 'message': 'java.lang.IllegalStateException', 'data': 'java.lang.IllegalStateException: UiAutomation not connected!\

Source code:
from multiprocessing import Process
if name == 'main':
# 创建两个子进程对象 Process(target=main, daemon=True, args=('LovefishO',))
process_task_one = Process(target=task_one)
process_task_two = Process(target=task_two)

def task_one():
d = u2.connect_adb_wifi("192.168.2.xxx:5555")
d.swipe_ext('up',0.5)

def task_two():
d = u2.connect_adb_wifi("192.168.2.xxx1:5555")
d.swipe_ext('up',0.5)

@codeskyblue
Copy link
Member

已修复

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

2 participants