did adb tcpip 5555
and adb connect ipaddress
. The adb devices
显示设备。但是当我运行 appium 服务器时,它显示没有连接 Android 设备。
appium python代码是
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['deviceName'] = 'Android'
desired_caps['automationName'] = 'uiautomator2'
desired_caps['udid'] = 'xx.xx.xx.xx:5555'
desired_caps['platformVersion'] = '6.0.1'
desired_caps['appPackage'] = 'PackageName'
desired_caps['appActivity'] = 'activityName'
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
appium服务器错误是
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 0 device(s) connected
[debug] [ADB] Could not find devices, restarting adb server...
[debug] [ADB] Restarting adb
[debug] [ADB] Killing adb server on port 5037
[debug] [ADB] Getting connected devices...
[debug] [ADB] 0 device(s) connected
找到了appium不断杀死adb服务器的原因并重新启动它。找到了解决方案here https://discuss.appium.io/t/why-appium-server-restart-adb-server-often/15479/3。
如果adb服务器在没有root权限的情况下重新启动,那么appium服务器将无法再连接到真实设备。
使用sudo
为我工作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)