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

d = u2.connect(device) 连接设备的时候报错 #1048

Open
jakernel opened this issue Nov 1, 2024 · 0 comments
Open

d = u2.connect(device) 连接设备的时候报错 #1048

jakernel opened this issue Nov 1, 2024 · 0 comments

Comments

@jakernel
Copy link

jakernel commented Nov 1, 2024

版本

  • 雷电9模拟器
  • uiautomator2的版本号 3.2.5

代码

多线程环境,执行到这一句的时候,会有概率报错
怀疑是adb连接不稳定,中途可能会掉线,但是没有自动重连的机制?

d = u2.connect(device)

错误堆栈

会出现下面几种稍有差别的错误

  File "uiautomator2\__init__.py", line 1107, in connect
  File "uiautomator2\__init__.py", line 1123, in connect_usb
  File "uiautomator2\__init__.py", line 69, in __init__
  File "uiautomator2\core.py", line 170, in __init__
  File "uiautomator2\core.py", line 195, in start_uiautomator
  File "uiautomator2\core.py", line 219, in _wait_ready
  File "uiautomator2\core.py", line 241, in _wait_app_process_ready
uiautomator2.exceptions.LaunchUiAutomationError: ('server quit unexpectly', '')
  File "uiautomator2\__init__.py", line 1107, in connect
  File "uiautomator2\__init__.py", line 1123, in connect_usb
  File "uiautomator2\__init__.py", line 69, in __init__
  File "uiautomator2\core.py", line 170, in __init__
  File "uiautomator2\core.py", line 195, in start_uiautomator
  File "uiautomator2\core.py", line 219, in _wait_ready
  File "uiautomator2\core.py", line 241, in _wait_app_process_ready
uiautomator2.exceptions.LaunchUiAutomationError: ('server quit unexpectly', '[server] INFO: [UiAutomator2Server] Starting Server\n')
  File "uiautomator2\__init__.py", line 1107, in connect
  File "uiautomator2\__init__.py", line 1123, in connect_usb
  File "uiautomator2\__init__.py", line 69, in __init__
  File "uiautomator2\core.py", line 170, in __init__
  File "uiautomator2\core.py", line 195, in start_uiautomator
  File "uiautomator2\core.py", line 219, in _wait_ready
  File "uiautomator2\core.py", line 241, in _wait_app_process_ready
uiautomator2.exceptions.LaunchUiAutomationError: ('server quit unexpectly', '[server] INFO: [UiAutomator2Server] Starting Server\n[server] INFO: [UiAutomator2Server] Starting Server\n[server] INFO: [UiAutomator2Server] Starting Server\nSLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".\nSLF4J: Defaulting to no-operation (NOP) logger implementation\nSLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.\n[server] INFO: [UiAutomator2Server] Starting Server\nSLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".\nSLF4J: Defaulting to no-operation (NOP) logger implementation\nSLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.\n')
  File "uiautomator2\__init__.py", line 1107, in connect
  File "uiautomator2\__init__.py", line 1123, in connect_usb
  File "uiautomator2\__init__.py", line 69, in __init__
  File "uiautomator2\core.py", line 170, in __init__
  File "uiautomator2\core.py", line 189, in start_uiautomator
  File "uiautomator2\core.py", line 201, in _setup_jar
  File "uiautomator2\core.py", line 214, in _check_device_file_hash
  File "adbutils\_device.py", line 191, in shell
  File "adbutils\_device.py", line 89, in open_transport
  File "adbutils\_adb.py", line 151, in check_okay
adbutils.errors.AdbError: device 'emulator-7462' not found
  File "uiautomator2\__init__.py", line 1107, in connect
  File "uiautomator2\__init__.py", line 1123, in connect_usb
  File "uiautomator2\__init__.py", line 69, in __init__
  File "uiautomator2\core.py", line 170, in __init__
  File "uiautomator2\core.py", line 189, in start_uiautomator
  File "uiautomator2\core.py", line 205, in _setup_jar
  File "adbutils\sync.py", line 103, in push
  File "adbutils\sync.py", line 60, in stat
  File "contextlib.py", line 113, in __enter__
  File "adbutils\sync.py", line 43, in _prepare_sync
  File "adbutils\_adb.py", line 151, in check_okay
adbutils.errors.AdbError: device offline
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

1 participant