openatx / uiautomator2

Android Uiautomator2 Python Wrapper
MIT License
6.57k stars 1.4k forks source link

安卓11车机系统,使用uiautomator2报错,安装不上小汽车的app,报错见正文,求解决办法! #838

Closed lqmchn closed 1 year ago

lqmchn commented 2 years ago
[D 221012 17:39:06 __init__:656] [pid:23520] [c19dbf4c] kill process(ps): uiautomator
[D 221012 17:39:07 __init__:387] [pid:23520] [c19dbf4c] Install app-uiautomator.apk
Exception in thread Thread-3:
Traceback (most recent call last):
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 482, in _jsonrpc_retry_call
    return self._jsonrpc_call(*args, **kwargs)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 516, in _jsonrpc_call
    (time.time() - request_start))
uiautomator2.exceptions.GatewayError: uiautomator2.GatewayError(gateway error, time used 0.0s)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\software\python363\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "E:\software\python363\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "E:\software\python363\lib\site-packages\uiautomator2\watcher.py", line 119, in _run_forever
    self._run()
  File "E:\software\python363\lib\site-packages\uiautomator2\watcher.py", line 93, in _run
    source = self._d.dump_hierarchy()
  File "E:\software\python363\lib\site-packages\decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "E:\software\python363\lib\site-packages\retry\api.py", line 74, in retry_decorator
    logger)
  File "E:\software\python363\lib\site-packages\retry\api.py", line 33, in __retry_internal
    return f()
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 973, in dump_hierarchy
    content = self.jsonrpc.dumpWindowHierarchy(compressed, None)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 476, in __call__
    http_timeout)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 484, in _jsonrpc_retry_call
    self.reset_uiautomator(str(e))  # uiautomator可能出问题了,强制重启一下
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 636, in reset_uiautomator
    launch_test_app=depth > 0)  # uiautomator 2.0
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 663, in _force_reset_uiautomator_v2
    self._setup_uiautomator()
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 388, in _setup_uiautomator
    self.push(apk_path, target_path)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 830, in push
    raise IOError("push", "%s -> %s" % (src, dst), r.text)
OSError: [Errno push] E:/software/python363/lib/site-packages/uiautomator2/assets/app-uiautomator.apk -> /data/local/tmp/app-uiautomator.apk: 'open /data/local/tmp/app-uiautomator.apk: permission denied\n'

[I 221012 17:39:11 watcher:144] [pid:23520] context closed
[D 221012 17:39:12 __init__:656] [pid:23520] [c19dbf4c] kill process(ps): uiautomator
[D 221012 17:39:12 __init__:387] [pid:23520] [c19dbf4c] Install app-uiautomator.apk
[D 221012 17:39:12 __init__:656] [pid:23520] [c19dbf4c] kill process(ps): uiautomator
[D 221012 17:39:12 __init__:387] [pid:23520] [c19dbf4c] Install app-uiautomator.apk
ERROR 10-12_17:39:13 run.py <module>: error occured !!!
ERROR 10-12_17:39:13 run.py <module>: Traceback (most recent call last):
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 482, in _jsonrpc_retry_call
    return self._jsonrpc_call(*args, **kwargs)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 516, in _jsonrpc_call
    (time.time() - request_start))
uiautomator2.exceptions.GatewayError: uiautomator2.GatewayError(gateway error, time used 0.0s)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run.py", line 119, in init_app
    device(scrollable=True).scroll.toEnd()
  File "E:\software\python363\lib\site-packages\uiautomator2\_selector.py", line 575, in __call__
    max_swipes, steps)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 476, in __call__
    http_timeout)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 484, in _jsonrpc_retry_call
    self.reset_uiautomator(str(e))  # uiautomator可能出问题了,强制重启一下
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 636, in reset_uiautomator
    launch_test_app=depth > 0)  # uiautomator 2.0
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 663, in _force_reset_uiautomator_v2
    self._setup_uiautomator()
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 388, in _setup_uiautomator
    self.push(apk_path, target_path)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 830, in push
    raise IOError("push", "%s -> %s" % (src, dst), r.text)
OSError: [Errno push] E:/software/python363/lib/site-packages/uiautomator2/assets/app-uiautomator.apk -> /data/local/tmp/app-uiautomator.apk: 'open /data/local/tmp/app-uiautomator.apk: permission denied\n'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 482, in _jsonrpc_retry_call
    return self._jsonrpc_call(*args, **kwargs)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 516, in _jsonrpc_call
    (time.time() - request_start))
uiautomator2.exceptions.GatewayError: uiautomator2.GatewayError(gateway error, time used 0.0s)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run.py", line 181, in <module>
    init_app(crawler.device)
  File "run.py", line 125, in init_app
    pageXml = device.dump_hierarchy(compressed=True)
  File "E:\software\python363\lib\site-packages\decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "E:\software\python363\lib\site-packages\retry\api.py", line 74, in retry_decorator
    logger)
  File "E:\software\python363\lib\site-packages\retry\api.py", line 33, in __retry_internal
    return f()
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 973, in dump_hierarchy
    content = self.jsonrpc.dumpWindowHierarchy(compressed, None)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 476, in __call__
    http_timeout)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 484, in _jsonrpc_retry_call
    self.reset_uiautomator(str(e))  # uiautomator可能出问题了,强制重启一下
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 636, in reset_uiautomator
    launch_test_app=depth > 0)  # uiautomator 2.0
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 663, in _force_reset_uiautomator_v2
    self._setup_uiautomator()
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 388, in _setup_uiautomator
    self.push(apk_path, target_path)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 830, in push
    raise IOError("push", "%s -> %s" % (src, dst), r.text)
OSError: [Errno push] E:/software/python363/lib/site-packages/uiautomator2/assets/app-uiautomator.apk -> /data/local/tmp/app-uiautomator.apk: 'open /data/local/tmp/app-uiautomator.apk: permission denied\n'

ERROR 10-12_17:39:13 run.py <module>: error img has been saved into E:\xingneng\outputs\c19dbf4c_20221012173851\screenshots\error_img.jpg
INFO 10-12_17:39:13 run.py <module>: real running time: 0.3653976798057556min
INFO 10-12_17:39:13 imgUtil.py __init__: add E:\xingneng\utils\openh264-1.6.0-win64msvc.dll to system path temporary.
INFO 10-12_17:39:13 imgUtil.py __init__: add E:\xingneng\utils\openh264-1.8.0-win64.dll to system path temporary.
ERROR 10-12_17:39:13 imgUtil.py jpg2video: Traceback (most recent call last):
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 482, in _jsonrpc_retry_call
    return self._jsonrpc_call(*args, **kwargs)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 516, in _jsonrpc_call
    (time.time() - request_start))
uiautomator2.exceptions.GatewayError: uiautomator2.GatewayError(gateway error, time used 0.0s)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run.py", line 119, in init_app
    device(scrollable=True).scroll.toEnd()
  File "E:\software\python363\lib\site-packages\uiautomator2\_selector.py", line 575, in __call__
    max_swipes, steps)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 476, in __call__
    http_timeout)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 484, in _jsonrpc_retry_call
    self.reset_uiautomator(str(e))  # uiautomator可能出问题了,强制重启一下
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 636, in reset_uiautomator
    launch_test_app=depth > 0)  # uiautomator 2.0
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 663, in _force_reset_uiautomator_v2
    self._setup_uiautomator()
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 388, in _setup_uiautomator
    self.push(apk_path, target_path)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 830, in push
    raise IOError("push", "%s -> %s" % (src, dst), r.text)
OSError: [Errno push] E:/software/python363/lib/site-packages/uiautomator2/assets/app-uiautomator.apk -> /data/local/tmp/app-uiautomator.apk: 'open /data/local/tmp/app-uiautomator.apk: permission denied\n'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 482, in _jsonrpc_retry_call
    return self._jsonrpc_call(*args, **kwargs)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 516, in _jsonrpc_call
    (time.time() - request_start))
uiautomator2.exceptions.GatewayError: uiautomator2.GatewayError(gateway error, time used 0.0s)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run.py", line 181, in <module>
    init_app(crawler.device)
  File "run.py", line 125, in init_app
    pageXml = device.dump_hierarchy(compressed=True)
  File "E:\software\python363\lib\site-packages\decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "E:\software\python363\lib\site-packages\retry\api.py", line 74, in retry_decorator
    logger)
  File "E:\software\python363\lib\site-packages\retry\api.py", line 33, in __retry_internal
    return f()
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 973, in dump_hierarchy
    content = self.jsonrpc.dumpWindowHierarchy(compressed, None)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 476, in __call__
    http_timeout)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 484, in _jsonrpc_retry_call
    self.reset_uiautomator(str(e))  # uiautomator可能出问题了,强制重启一下
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 636, in reset_uiautomator
    launch_test_app=depth > 0)  # uiautomator 2.0
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 663, in _force_reset_uiautomator_v2
    self._setup_uiautomator()
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 388, in _setup_uiautomator
    self.push(apk_path, target_path)
  File "E:\software\python363\lib\site-packages\uiautomator2\__init__.py", line 830, in push
    raise IOError("push", "%s -> %s" % (src, dst), r.text)
OSError: [Errno push] E:/software/python363/lib/site-packages/uiautomator2/assets/app-uiautomator.apk -> /data/local/tmp/app-uiautomator.apk: 'open /data/local/tmp/app-uiautomator.apk: permission denied\n'
lqmchn commented 1 year ago

This issue was caused by a limitation made by the system steward, not a uiautomator2 issue, close it now, thanks all the same.