Adb can find device,but appium can’t

I connect the android with cable,and can find the device from adb device.you can see from this pic,one simulator one real device.
image

but,when I try run my script, the appium server cannot find device,the log like below.

[HTTP] {“capabilities”:{“firstMatch”:[{“platformName”:“Android”,“appium:platformVersion”:“4.4.2”,“appium:deviceName”:“Galaxy Note3”,“appium:udid”:“1ec95235”,“appium:appPackage”:“uatUg.transsion.shopnc”,“appium:appActivity”:“com.transsion.shopnc.app.SplashActivity”,“appium:noReset”:true,“appium:automationName”:“UiAutomator1”}]},“desiredCapabilities”:{“platformName”:“Android”,“platformVersion”:“4.4.2”,“deviceName”:“Galaxy Note3”,“udid”:“1ec95235”,“appPackage”:“uatUg.transsion.shopnc”,“appActivity”:“com.transsion.shopnc.app.SplashActivity”,“noReset”:true,“automationName”:“UiAutomator1”}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [{“platformName”:“Android”,“platformVersion”:“4.4.2”,“deviceName”:“Galaxy Note3”,“udid”:“1ec95235”,“appPackage”:“uatUg.transsion.shopnc”,“appActivity”:“com.transsion.shopnc.app.SplashActivity”,“noReset”:true,“automationName”:“UiAutomator1”},null,{“firstMatch”:[{“platformName”:“Android”,“appium:platformVersion”:“4.4.2”,“appium:deviceName”:“Galaxy Note3”,“appium:udid”:“1ec95235”,“appium:appPackage”:“uatUg.transsion.shopnc”,“appium:appActivity”:“com.transsion.shopnc.app.SplashActivity”,“appium:noReset”:true,“appium:automationName”:“UiAutomator1”}]}]
[debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1585036356295 (15:52:36 GMT+0800 (GMT+08:00))
[Appium] Appium v1.17.0 creating new AndroidDriver (v4.27.0) session
[debug] [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {
[debug] [BaseDriver] “alwaysMatch”: {
[debug] [BaseDriver] “platformName”: “Android”,
[debug] [BaseDriver] “appium:platformVersion”: “4.4.2”,
[debug] [BaseDriver] “appium:deviceName”: “Galaxy Note3”,
[debug] [BaseDriver] “appium:udid”: “1ec95235”,
[debug] [BaseDriver] “appium:appPackage”: “uatUg.transsion.shopnc”,
[debug] [BaseDriver] “appium:appActivity”: “com.transsion.shopnc.app.SplashActivity”,
[debug] [BaseDriver] “appium:noReset”: true,
[debug] [BaseDriver] “appium:automationName”: “UiAutomator1”
[debug] [BaseDriver] },
[debug] [BaseDriver] “firstMatch”: [
[debug] [BaseDriver] {}
[debug] [BaseDriver] ]
[debug] [BaseDriver] }
[BaseDriver] Session created with session id: ab118d9c-e9f0-46cf-8f47-36f5d4746190
[ADB] Using ‘adb.exe’ from ‘D:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe’
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices…
[debug] [ADB] No connected devices have been detected
[debug] [ADB] Could not find devices, restarting adb server…
[debug] [ADB] Restarting adb
[debug] [ADB] Killing adb server on port ‘5037’
[debug] [ADB] Running ‘D:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -P 5037 kill-server’
[debug] [ADB] Getting connected devices…
[debug] [ADB] No connected devices have been detected
[debug] [ADB] Could not find devices, restarting adb server…
[debug] [ADB] Restarting adb
[debug] [ADB] Killing adb server on port ‘5037’
[debug] [ADB] Running ‘D:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -P 5037 kill-server’
[debug] [ADB] Getting connected devices…
[debug] [ADB] No connected devices have been detected
[debug] [ADB] Could not find devices, restarting adb server…
[debug] [ADB] Restarting adb
[debug] [ADB] Killing adb server on port ‘5037’
[debug] [ADB] Running ‘D:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -P 5037 kill-server’
[debug] [ADB] Getting connected devices…
[debug] [ADB] No connected devices have been detected
[debug] [ADB] Could not find devices, restarting adb server…
[debug] [ADB] Restarting adb
[debug] [ADB] Killing adb server on port ‘5037’
[debug] [ADB] Running ‘D:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -P 5037 kill-server’
[debug] [ADB] Getting connected devices…
[debug] [ADB] No connected devices have been detected
[debug] [ADB] Could not find devices, restarting adb server…
[debug] [ADB] Restarting adb
[debug] [ADB] Killing adb server on port ‘5037’
[debug] [ADB] Running ‘D:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -P 5037 kill-server’
[debug] [AndroidDriver] Shutting down Android driver
[debug] [AndroidDriver] Called deleteSession but bootstrap wasn’t active
[debug] [BaseDriver] Event ‘newSessionStarted’ logged at 1585036379904 (15:52:59 GMT+0800 (GMT+08:00))
[debug] [W3C] Encountered internal error running command: Error: Could not find a connected Android device in 23574ms.
[debug] [W3C] at getDevices (D:\Program Files\nodejs\node_global\node_modules\appium\[email protected]@appium-adb\lib\tools\system-calls.js:211:13)
[debug] [W3C] at getDevices (D:\Program Files\nodejs\node_global\node_modules\appium\[email protected]@appium-adb\lib\tools\system-calls.js:224:18)
[debug] [W3C] Destroying socket connection
[HTTP] ← POST /wd/hub/session 500 23620 ms - 717
[HTTP]

my python script like this

from appium import webdriver
desired_caps = {
“platformName”: “Android”,
“platformVersion”: “4.4.2”,
“deviceName”: “Galaxy Note3”,
“udid”: “1ec95235”,
“appPackage”: “xxxxxx”,
“appActivity”: “com.xxxxxx”,
“noReset”: True
}

driver = webdriver.Remote(‘http://localhost:4723/wd/hub’, desired_caps)

Platform : Android
Appium version: 1.17.0
adb version: 1.0.41
both Simulator/Emulator and Real Device have the same issue
The language you are using for writing tests:Python
OS:windows 10

1 Like