openatx / uiautomator2

Android Uiautomator2 Python Wrapper
MIT License
6.48k stars 1.39k forks source link

多线程adb很容易卡死 #937

Closed blueslilili closed 8 months ago

blueslilili commented 8 months ago

python写了个多线程的脚本进行自动化测试(while循环,不断执行adb脚本),一台PC(windows)通过uiautomator2以wifi连接多台真机,一个线程连接一台设备,运行一段时间后,adb就会卡死,cmd输入adb devices或者adb kill-server都没响应,查看任务管理器,只有一个adb.exe进程,强制杀掉adb进程后,程序又可以正常运行了,过一会又卡死。

有什么办法可以解决?区分端口起多个adb.exe进程,一个线程用一个adb进程,貌似可以解决,但是uiautomator2默认连接的5037端口,这种方式实现不了