NetEaseGame / ATX

Smart phone automation tool. Support iOS, Android, WebApp and game.
Apache License 2.0
1.58k stars 422 forks source link

执行官网测试脚本提示RuntimeError: Error run: adb forward tcp:<any> tcp:9008 #126

Closed wyhwow closed 6 years ago

wyhwow commented 7 years ago

Version information

在按照指引安装好环境后,执行test.py 提示报错信息如下: ` File "D:\test.py", line 5, in d.screenshot('screen.png') # 截图 File "C:\Python27\lib\site-packages\atx\drivers\mixin.py", line 62, in _inner _retval = fn(*args, **kwargs) File "C:\Python27\lib\site-packages\atx\drivers\mixin.py", line 387, in screenshot screen = self._take_screenshot() File "C:\Python27\lib\site-packages\atx\drivers\android.py", line 279, in _take_screenshot screen = self._screenshot_minicap() File "C:\Python27\lib\site-packages\atx\drivers\android.py", line 231, in _screenshot_minicap self._minicap_params(), phone_tmp_file) File "C:\Python27\lib\site-packages\atx\drivers\android.py", line 215, in _minicap_params rotation = self.rotation File "C:\Python27\lib\site-packages\atx\drivers\android.py", line 202, in rotation return self.adb_device.rotation() or self.info['displayRotation'] File "C:\Python27\lib\site-packages\uiautomator__init.py", line 616, in info return self.server.jsonrpc.deviceInfo() File "C:\Python27\lib\site-packages\uiautomator\init.py", line 408, in jsonrpc return self.jsonrpc_wrap(timeout=int(os.environ.get("jsonrpc_timeout", 90))) File "C:\Python27\lib\site-packages\uiautomator\init.py", line 446, in jsonrpc_wrap return JsonRPCClient(self.rpc_uri, File "C:\Python27\lib\site-packages\uiautomator\init.py", line 549, in rpc_uri return "http://%s:%d/jsonrpc/0" % (self.adb.adb_server_host, self.local_port) File "C:\Python27\lib\site-packages\uiautomator\init__.py", line 381, in local_port raise RuntimeError("Error run: adb forward tcp: tcp:%d" % self.device_port) RuntimeError: Error run: adb forward tcp: tcp:9008```

  1. adb devices 显示设备连接正常
  2. atx的安装检查也是没有问题 显示版本为adb 1.0.31
clobob commented 7 years ago

@wyhwow ,如何解决的?我遇到了相同的问题

codeskyblue commented 7 years ago

升级adb 到1.0.36

cxMax commented 7 years ago

1.升级adb , 我的adb原来1.0.31就一直报错, 现在升级到1.0.39就ok了

  1. 试试运行下面这段代码
    driver = atx.connect()
    driver.start_app({$your_app_package_name})