当前位置:   article > 正文

uiautomator2连接报错uiautomator2 is not reponding/Local server not started, start with_uiautomator2 no start

uiautomator2 no start

uiautomator2连接,python命令行里connect正常,print(d.info)就报错
另外,执行了python -m uiautomator2 init,显示successful,但是手机上找不到atx 和com.github.uiautomator.test

import uiautomator2
>>> d = uiautomator2.connect()
[I 200430 18:38:17 init:155] uiautomator2 version: 2.7.3
[I 200430 18:38:17 init:348] Install minicap, minitouch
[I 200430 18:38:17 init:363] Install com.github.uiautomator, com.github.uiautomator.test 2.3.1
[I 200430 18:38:18 init:328] - app-uiautomator.apk installed
[I 200430 18:38:19 init:328] - app-uiautomator-test.apk installed
[I 200430 18:38:19 init:373] Check atx-agent version
Successfully init AdbDevice(serial=4b285f2c)
>>> print(d.info)
C:\Users\luojie\Anaconda3\lib\site-packages\uiautomator2\__init__.py:558: RuntimeWarning: uiautomator2 is not reponding, restart uiautomator2 automatically
  stacklevel=1)
[D 200430 18:38:27 __init__:774] restart-uiautomator since "UiAutomator stopped"
[D 200430 18:38:27 __init__:844] Device: Xiaomi, 4b285f2c
[D 200430 18:38:27 __init__:854] kill process(ps): uiautomator
[D 200430 18:38:28 __init__:868] uiautomator-v2 is starting ... left: 40.0s
[D 200430 18:38:29 __init__:868] uiautomator-v2 is starting ... left: 39.0s
[D 200430 18:38:30 __init__:868] uiautomator-v2 is starting ... left: 37.9s
[D 200430 18:38:30 __init__:774] restart-uiautomator since "UiAutomator stopped"
[D 200430 18:38:30 __init__:844] Device: Xiaomi, 4b285f2c
[D 200430 18:38:30 __init__:854] kill process(ps): uiautomator
[D 200430 18:38:30 __init__:826] grant permissions
[D 200430 18:38:31 __init__:868] uiautomator-v2 is starting ... left: 40.0s
[D 200430 18:38:32 __init__:868] uiautomator-v2 is starting ... left: 39.0s
[D 200430 18:38:33 __init__:868] uiautomator-v2 is starting ... left: 37.9s
Traceback (most recent call last):

  File "<ipython-input-5-663fb1bf5cfd>", line 1, in <module>
    print(d.info)

  File "C:\Users\luojie\Anaconda3\lib\site-packages\uiautomator2\__init__.py", line 1616, in __getattr__
    return getattr(self._default_session, attr)

  File "C:\Users\luojie\Anaconda3\lib\site-packages\uiautomator2\session.py", line 601, in info
    return self.jsonrpc.deviceInfo()

  File "C:\Users\luojie\Anaconda3\lib\site-packages\uiautomator2\__init__.py", line 547, in __call__
    http_timeout)

  File "C:\Users\luojie\Anaconda3\lib\site-packages\uiautomator2\__init__.py", line 559, in jsonrpc_retry_call
    self.reset_uiautomator("UiAutomator stopped")

  File "C:\Users\luojie\Anaconda3\lib\site-packages\uiautomator2\__init__.py", line 791, in reset_uiautomator
    depth=depth + 1)

  File "C:\Users\luojie\Anaconda3\lib\site-packages\uiautomator2\__init__.py", line 791, in reset_uiautomator
    depth=depth + 1)

  File "C:\Users\luojie\Anaconda3\lib\site-packages\uiautomator2\__init__.py", line 771, in reset_uiautomator
    "adb shell am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner",

OSError: [WinError adb shell am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner] UiAutomator stopped: 'https://github.com/openatx/uiautomator2/wiki/Common-issues'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52

直接

python -m weditor
  • 1

连接手机,发现报错:
Local server not started, start with
python -m weditor

解决方法:小米手机没开usb安装,所以atx和com.github.uiautomator.test都没安装上,在开发者选项中打开 usb安装 ,命令行执行

python -m uiautomator2 init
  • 1

在手机端点同意安装,再执行

python -m weditor
  • 1

填入手机序列号即可,但目前仍然不能通过ip连接。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/556687
推荐阅读
相关标签
  

闽ICP备14008679号