appium初运行报错找不到设备

image
详细APPIUM的报错如下:
[Appium] Welcome to Appium v1.10.0

[Appium] Appium REST http interface listener started on 0.0.0.0:4723

[HTTP] --> POST /wd/hub/session

[HTTP] {“capabilities”:{“firstMatch”:[{“platformName”:“Android”,“appium:platformVersion”:“6.0”,“appium:deviceName”:“127.0.0.1:7555”,“appium:appPackage”:“com.android.settings”,“appium:appActivity”:“com.android.settings.Settings”}]},“desiredCapabilities”:{“platformName”:“Android”,“platformVersion”:“6.0”,“deviceName”:“127.0.0.1:7555”,“appPackage”:“com.android.settings”,“appActivity”:“com.android.settings.Settings”}}

[W3C] Calling AppiumDriver.createSession() with args: [{“platformName”:“Android”,“platformVersion”:“6.0”,“deviceName”:“127.0.0.1:7555”,“appPackage”:“com.android.settings”,“appActivity”:“com.android.settings.Settings”},null,{“firstMatch”:[{“platformName”:“Android”,“appium:platformVersion”:“6.0”,“appium:deviceName”:“127.0.0.1:7555”,“appium:appPackage”:“com.android.settings”,“appium:appActivity”:“com.android.settings.Settings”}]}]

[BaseDriver] Event ‘newSessionRequested’ logged at 1603728521173 (00:08:41 GMT+0800 (中国标准时间))

[Appium] Consider setting ‘automationName’ capability to ‘UiAutomator2’ on Android >= 6, since UIAutomator framework is not maintained anymore by the OS vendor.

[Appium] Creating new AndroidDriver (v4.8.0) session

[Appium] Capabilities:

[Appium] platformName: Android

[Appium] platformVersion: 6.0

[Appium] deviceName: 127.0.0.1:7555

[Appium] appPackage: com.android.settings

[Appium] appActivity: com.android.settings.Settings

[BaseDriver] W3C capabilities {“alwaysMatch”:{“platformNa… and MJSONWP desired capabilities {“platformName”:“Android”,”… were provided

[BaseDriver] Creating session with W3C capabilities: {“alwaysMatch”:{"platformNa…

[BaseDriver] Session created with session id: 4b079086-8e42-4a97-b482-f0968cdced7e

[AndroidDriver] Java version is: 15

[AndroidDriver] Retrieving device list

[ADB] Trying to find a connected android device

[ADB] Getting connected devices…

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Getting connected devices…

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Getting connected devices…

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Getting connected devices…

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Getting connected devices…

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Getting connected devices…

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Getting connected devices…

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Getting connected devices…

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server…

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[AndroidDriver] Shutting down Android driver

[AndroidDriver] Called deleteSession but bootstrap wasn’t active

[BaseDriver] Event ‘newSessionStarted’ logged at 1603728564328 (00:09:24 GMT+0800 (中国标准时间))

[W3C] Encountered internal error running command: Error: Could not find a connected Android device.

[W3C] at getDevices (C:\Program Files (x86)\Appium\resources\app\node_modules\appium-adb\lib\tools\system-calls.js:195:13)

[W3C] at getDevices (C:\Program Files (x86)\Appium\resources\app\node_modules\appium-adb\lib\tools\system-calls.js:212:20)

[W3C] at process._tickCallback (internal/process/next_tick.js:68:7)

[HTTP] <-- POST /wd/hub/session 500 43160 ms - 684


device name试过以下两种都不行
desired_caps[‘deviceName’] = ‘127.0.0.1:7555’

desired_caps[‘deviceName’] = ‘127.0.0.1:7555 device’

在pycharm内的报错为如下:
C:\Users\Geili\PycharmProjects\ck15DAYU\venv\Scripts\python.exe C:/Users/Geili/PycharmProjects/ck15DAYU/app/test_firstappium.py
Traceback (most recent call last):
File “C:/Users/Geili/PycharmProjects/ck15DAYU/app/test_firstappium.py”, line 11, in
driver = webdriver.Remote(‘http://localhost:4723/wd/hub’, desired_caps)
File “C:\Users\Geili\PycharmProjects\ck15DAYU\venv\lib\site-packages\appium\webdriver\webdriver.py”, line 151, in init
super().init(
File “C:\Users\Geili\PycharmProjects\ck15DAYU\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 157, in init
self.start_session(capabilities, browser_profile)
File “C:\Users\Geili\PycharmProjects\ck15DAYU\venv\lib\site-packages\appium\webdriver\webdriver.py”, line 225, in start_session
response = self.execute(RemoteCommand.NEW_SESSION, parameters)
File “C:\Users\Geili\PycharmProjects\ck15DAYU\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 321, in execute
self.error_handler.check_response(response)
File “C:\Users\Geili\PycharmProjects\ck15DAYU\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py”, line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not find a connected Android device.

感觉需要远程才能解决问题,微信号:13172661165
需要远程就加微信,向日葵走起吧

问题已解决:
java环境+appium版本过低+多个adb环境错乱+sdk版本过低,远程解决,帖子可以关闭了

1 Like

谢谢通通,已经解决!

关闭