2

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
bakarin
  • 622
  • 5
  • 17

2 Answers2

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.

bakarin
  • 622
  • 5
  • 17
0

I had the same problem. the solution was,

  1. set up adb path in system variable(~/sdk/platform-tools). as the ADB path from where I was connecting the device over wifi(adb connect xx.xx.xx.xx:5555) was different from the adb under ~/sdk/platform-tools.
  2. use capability <i>capabilities.setCapability("suppressKillServer", true);</i> in code
Louay Sleman
  • 1,794
  • 2
  • 15
  • 39