分别adb tcpip 5555
和adb connect ipaddress
。 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
答案 0 :(得分:0)
找到了appium继续杀死adb服务器并重新启动它的原因。找到了解决方法here。
如果adb服务器在没有root特权的情况下重新启动,则appium Server无法再连接到真实设备。
使用sudo
对我有用。