参考https://testerhome.com/topics/11588
安装 atx-agent 环境时遇到
2018-05-18 13:58:35,549 - main.py:254 - INFO - atx-server addr 192.168.137.104:8000
2018-05-18 13:58:35,572 - main.py:269 - INFO - Detect pluged devices: [u'192.168.137.118:5555']
2018-05-18 13:58:35,572 - main.py:286 - INFO - Device(192.168.137.118:5555) initialing ...
2018-05-18 13:58:35,842 - main.py:113 - INFO - install minicap
2018-05-18 13:58:36,160 - main.py:120 - INFO - install minitouch
2018-05-18 13:58:36,407 - main.py:137 - INFO - apk(1.0.14) already installed, skip
2018-05-18 13:58:36,509 - main.py:175 - INFO - atx-agent(0.3.2) already installed, skip
2018-05-18 13:58:36,648 - main.py:212 - INFO - launch atx-agent daemon
2018-05-18 13:58:41,788 - main.py:238 - ERROR - failur
这个错误,提示无法启动 atx-agent

后来在 shell 里模拟启动该服务发现不加-d 参数是可以正常启动的:/data/local/tmp/atx-agent 可以正常启动该服务。
所以修改启动参数 uiautomator2/main.py 中第 215 行

去掉参数 ‘-d’
然后再启动,发现程序一直不往下继续进行,一直卡在启动 atx-agent 服务上,但是服务已经成功启动了。
所以继续查代码。
经过阅读大神的代发发现 adbutils.py 这个文件中第 41 行中所用到的 subprocess.check_output() 是 pyton3 的方法,在 python2.7 中根本没法用。
所以修改了下 uiautomator2/adbutils.py 中该行代码,用 subprocess.Popen 代替:

就可以启动成功了。
然后就可以正常运行了。


↙↙↙阅读原文可查看相关链接,并与作者交流