问题
did adb tcpip 5555
and adb connect ipaddress
. The adb devices
show the device. But when i run the appium server, its showing no android device connected.
The appium python code is
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)
The appium server error is
[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
回答1:
found the reason why appium kept on killing the adb server and restarted it. found the solution here.
If adb server restart without root privilege, then appium Server can't connect to real device anymore.
Using sudo
worked for me.
来源:https://stackoverflow.com/questions/51438617/appium-server-not-detecting-the-device-connected-through-wifi