Appium 启动不了 selendroid,求助

rattlesnake · 2013年12月30日 · 最后由 丧尸没有牙齿 回复于 2017年06月10日 · 3708 次阅读

我启动一个 webview 的 apk 的时候,Log 如下

debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"desiredCapabilities":{"app":"D:\MobileAu
to\apk\HybridApp.apk","platform":"windows","browserName":"","app-package":"com
.example.webview","device":"selendroid","app-activity":".WebViewActivity","versi
on":"4.4"}}
info: Using local app from desiredCaps: D:\MobileAuto\apk\HybridApp.apk
info: Creating new appium session cacd305a-7b98-4784-90fa-53ff1f049d12
info: Starting selendroid server
info: Checking whether selendroid is built yet
info: Selendroid server exists!
info: Preparing device for session
info: Checking whether app is actually present
info: Checking whether adb is present
info: [ADB] Using adb from D:\Android_SDK\sdk\platform-tools\adb.exe
info: Trying to find a connected android device
info: [ADB] Getting connected devices...
debug: executing: "D:\Android_SDK\sdk\platform-tools\adb.exe" devices
info: [ADB] 1 device(s) connected
info: Setting device id to emulator-5554
info: [ADB] Waiting for device to be ready and to respond to shell commands (tim
eout = 5)
debug: executing: "D:\Android_SDK\sdk\platform-tools\adb.exe" -s emulator-5554 w
ait-for-device
debug: executing: "D:\Android_SDK\sdk\platform-tools\adb.exe" -s emulator-5554 s
hell "echo 'ready'"
info: Starting logcat capture
info: Rebuilt selendroid apk does not exist, uninstalling any instances of it on
device to make way for new one
info: Uninstalling com.example.webview.selendroid
debug: executing: "D:\Android_SDK\sdk\platform-tools\adb.exe" -s emulator-5554 u
ninstall com.example.webview.selendroid
debug: App was not uninstalled, maybe it wasn't on device?
info: Rebuilt selendroid server does not exist, inserting modified manifest
info: Inserting selendroid manifest
info: Checking whether aapt is present
info: [ADB] Using aapt from D:\Android_SDK\sdk\build-tools\18.0.1\aapt.exe
info: Compiling manifest C:\Windows\Temp\com.example.webview\AndroidManifest.xml

info: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Required platform does
n't exist (API level >= 17)
info: Responding to client with error: {"status":33,"value":{"message":"A new se
ssion could not be created. (Original error: Required platform doesn't exist (AP
I level >= 17))","origValue":"Required platform doesn't exist (API level >= 17)"
},"sessionId":null}
POST /wd/hub/session 500 3841ms - 248b

我看了下 Log,好像是 selendroid 启动不了,这个怎么解决啊?谢谢!

共收到 7 条回复 时间 点赞

Required platform does
n't exist (API level >= 17)

说需要 API level >= 17

#1 楼 @lihuazhang 我启动的模拟器的版本是 Android 4.4, API level 到 19 了啊,这个错误我怎么也想不通。我是在 windows 上启动的 appium

#2 楼 @rattlesnake 上次@seveniruby 说 4.4 暂时还没支持,可能有这个问题。 你试试看 4.3 的模拟器?

#3 楼 @lihuazhang 这个之前有人提供了, 你可以先把自己的 device 配置, 改成 18。 改成 18 是可以测试 4.4 的。 我们最近会向官方提交代码, 让他们支持 4.4

@seveniruby 大神有时间看看我这个为啥跑不起来 提示 API>=17 但是明明就用的 4.3 啦~

def setUp(self):
       desired_caps_android = {
           'platformVersion': '4.3', \
           'deviceName': 'SM-G7108V', \
           'platformName': 'Android', \
           'automationName': 'Selendroid', \
           'app': PATH('C:\Program Files (x86)\Appium\golo.apk'), \
           'unicodeKeyboard': True, \
           'resetKeyboard': True, \
           'noReset':True,
       }

报错信息:

Traceback (most recent call last):
File "C:\Users\Win-Attack\Desktop\test_get_toast.py", line 38, in setUp
self.driver=webdriver.Remote('http://localhost:4723/wd/hub,desired_caps_android')
File "C:\Python27\lib\site-packages\appium\webdriver\webdriver.py", line 36, in init
super(WebDriver, self).init(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 90, in init
self.start_session(desired_capabilities, browser_profile)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 177, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: A new session could not be created. (Original error: Required platform doesn't exist (API level >= 17))


og:

info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe devices
info: [debug] 0 device(s) connected
info: [debug] Could not find devices, restarting adb server...
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe kill-server
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe devices
info: [debug] 0 device(s) connected
info: [debug] Could not find devices, restarting adb server...
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe kill-server
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe devices
info: [debug] 0 device(s) connected
info: [debug] Could not find devices, restarting adb server...
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe kill-server
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe devices
info: [debug] 0 device(s) connected
info: [debug] Could not find devices, restarting adb server...
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe kill-server
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe devices
info: [debug] 0 device(s) connected
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Could not find a conne
cted Android device.
info: [debug] Error: Could not find a connected Android device.
at [object Object].ADB.getDevicesWithRetry (C:\Program Files (x86)\Appium\no
de_modules\appium\node_modules\appium-adb\lib\adb.js:606:15)
at [object Object].androidCommon.prepareActiveDevice (C:\Program Files (x86)
\Appium\node_modules\appium\lib\devices\android\android-common.js:400:12)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\a
ppium\lib\devices\android\android-common.js:326:26)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:607:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:246:17
at iterate (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\a
sync\lib\async.js:146:13)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:157:25
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:248:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:612:34
at [object Object].androidCommon.ensureDeviceLocale (C:\Program Files (x86)\
Appium\node_modules\appium\lib\devices\android\android-common.js:371:45)
at [object Object].androidCommon.prepareEmulator (C:\Program Files (x86)\App
ium\node_modules\appium\lib\devices\android\android-common.js:364:10)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\a
ppium\lib\devices\android\android-common.js:325:26)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:607:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:246:17
at iterate (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\a
sync\lib\async.js:146:13)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:157:25
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:248:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:612:34
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\a
ppium\lib\devices\android\android-common.js:344:9)
at FSReqWrap.oncomplete (fs.js:82:15)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"
A new session could not be created. (Original error: Could not find a connected
Android device.)","origValue":"Could not find a connected Android device."},"ses
sionId":null}
info: <-- POST /wd/hub/session 500 20799.770 ms - 206
info: --> POST /wd/hub/session {"desiredCapabilities":{"deviceName":"SM-G7108V",
"unicodeKeyboard":true,"automationName":"Selendroid","noReset":true,"resetKeyboa
rd":true,"platformVersion":"4.3","platformName":"Android","app":"C:\Program Fil
es (x86)\Appium\golo.apk"}}
info: Client User-Agent string: Python-urllib/2.7
info: [debug] No appActivity desired capability or server param. Parsing from ap
k.
info: [debug] No appPackage desired capability or server param. Parsing from apk
.
info: [debug] Using local app from desired caps: C:\Program Files (x86)\Appium\g
olo.apk
info: [debug] Creating new appium session 1c0ef176-1fc1-472a-ac26-b4d9eb7f1766
info: [debug] Starting selendroid server
info: [debug] Getting Java version
info: Java version is: 1.8.0_91
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe
info: [debug] Checking whether selendroid is built yet
info: [debug] Selendroid server exists!
info: [debug] Using fast reset? false
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device 278f9869
info: [debug] Setting device id to 278f9869
info: [debug] Waiting for device to be ready and to respond to shell commands (t
imeout = 5)
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe -s 278f9869 wait-for-device
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe -s 278f9869 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\Win-Attack\AppData\Local\Android\sdk\buil
d-tools\24.0.0-preview\aapt.exe
info: [debug] Checking if has internet permission from manifest.
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\build
-tools\24.0.0-preview\aapt.exe dump badging "C:\Program Files (x86)\Appium\golo.
apk"
info: [debug] Parsing package and activity from app manifest
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\Win-Attack\AppData\Local\Android\sdk\buil
d-tools\24.0.0-preview\aapt.exe
info: [debug] Extracting package and launch activity from manifest.
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\build
-tools\24.0.0-preview\aapt.exe dump badging "C:\Program Files (x86)\Appium\golo.
apk"
info: [debug] badging package: com.cnlaunch.golo3
info: [debug] badging act: com.cnlaunch.golo3.activity.WelcomeActivity
info: [debug] Parsed package and activity are: com.cnlaunch.golo3/com.cnlaunch.g
olo3.activity.WelcomeActivity
info: [debug] Rebuilt selendroid server does not exist, inserting modified manif
est
info: [debug] Inserting selendroid manifest
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\Win-Attack\AppData\Local\Android\sdk\buil
d-tools\24.0.0-preview\aapt.exe
info: [debug] Compiling manifest C:\Users\WIN-AT~1\AppData\Local\Temp\com.cnlaun
ch.golo3\AndroidManifest.xml
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Required platform does
n't exist (API level >= 17)
info: [debug] Error: Required platform doesn't exist (API level >= 17)
at [object Object].ADB.compileManifest (C:\Program Files (x86)\Appium\node_m
odules\appium\node_modules\appium-adb\lib\adb.js:306:15)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\a
ppium\lib\devices\android\selendroid.js:444:16)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:607:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:246:17
at iterate (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\a
sync\lib\async.js:146:13)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:157:25
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:248:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:612:34
at [object Object].ADB.checkSdkBinaryPresent (C:\Program Files (x86)\Appium\
node_modules\appium\node_modules\appium-adb\lib\adb.js:116:5)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\a
ppium\lib\devices\android\selendroid.js:442:30)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:607:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:246:17
at iterate (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\a
sync\lib\async.js:146:13)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:157:25
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:248:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:612:34
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\mkdirp\ind
ex.js:48:26
at FSReqWrap.oncomplete (fs.js:82:15)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"
A new session could not be created. (Original error: Required platform doesn't e
xist (API level >= 17))","origValue":"Required platform doesn't exist (API level

= 17)"},"sessionId":null}
info: <-- POST /wd/hub/session 500 607.013 ms - 220
info: --> POST /wd/hub/session {"desiredCapabilities":{"deviceName":"SM-G7108V",
"unicodeKeyboard":true,"automationName":"Selendroid","noReset":true,"resetKeyboa
rd":true,"platformVersion":"4.1","platformName":"Android","app":"C:\Program Fil
es (x86)\Appium\golo.apk"}}
info: Client User-Agent string: Python-urllib/2.7
info: [debug] No appActivity desired capability or server param. Parsing from ap
k.
info: [debug] No appPackage desired capability or server param. Parsing from apk
.
info: [debug] Using local app from desired caps: C:\Program Files (x86)\Appium\g
olo.apk
info: [debug] Creating new appium session 3b1b3b79-f95b-4175-9d15-a22d68178251
info: [debug] Starting selendroid server
info: [debug] Getting Java version
info: Java version is: 1.8.0_91
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe
info: [debug] Checking whether selendroid is built yet
info: [debug] Selendroid server exists!
info: [debug] Using fast reset? false
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device 278f9869
info: [debug] Setting device id to 278f9869
info: [debug] Waiting for device to be ready and to respond to shell commands (t
imeout = 5)
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe -s 278f9869 wait-for-device
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\platf
orm-tools\adb.exe -s 278f9869 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\Win-Attack\AppData\Local\Android\sdk\buil
d-tools\24.0.0-preview\aapt.exe
info: [debug] Checking if has internet permission from manifest.
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\build
-tools\24.0.0-preview\aapt.exe dump badging "C:\Program Files (x86)\Appium\golo.
apk"
info: [debug] Parsing package and activity from app manifest
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\Win-Attack\AppData\Local\Android\sdk\buil
d-tools\24.0.0-preview\aapt.exe
info: [debug] Extracting package and launch activity from manifest.
info: [debug] executing cmd: C:\Users\Win-Attack\AppData\Local\Android\sdk\build
-tools\24.0.0-preview\aapt.exe dump badging "C:\Program Files (x86)\Appium\golo.
apk"
info: [debug] badging package: com.cnlaunch.golo3
info: [debug] badging act: com.cnlaunch.golo3.activity.WelcomeActivity
info: [debug] Parsed package and activity are: com.cnlaunch.golo3/com.cnlaunch.g
olo3.activity.WelcomeActivity
info: [debug] Rebuilt selendroid server does not exist, inserting modified manif
est
info: [debug] Inserting selendroid manifest
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\Win-Attack\AppData\Local\Android\sdk\buil
d-tools\24.0.0-preview\aapt.exe
info: [debug] Compiling manifest C:\Users\WIN-AT~1\AppData\Local\Temp\com.cnlaun
ch.golo3\AndroidManifest.xml
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Required platform does
n't exist (API level >= 17)
info: [debug] Error: Required platform doesn't exist (API level >= 17)
at [object Object].ADB.compileManifest (C:\Program Files (x86)\Appium\node_m
odules\appium\node_modules\appium-adb\lib\adb.js:306:15)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\a
ppium\lib\devices\android\selendroid.js:444:16)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:607:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:246:17
at iterate (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\a
sync\lib\async.js:146:13)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:157:25
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:248:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:612:34
at [object Object].ADB.checkSdkBinaryPresent (C:\Program Files (x86)\Appium\
node_modules\appium\node_modules\appium-adb\lib\adb.js:116:5)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\a
ppium\lib\devices\android\selendroid.js:442:30)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:607:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:246:17
at iterate (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\a
sync\lib\async.js:146:13)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:157:25
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:248:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\
async.js:612:34
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\mkdirp\ind
ex.js:48:26
at FSReqWrap.oncomplete (fs.js:82:15)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"
A new session could not be created. (Original error: Required platform doesn't e
xist (API level >= 17))","origValue":"Required platform doesn't exist (API level
= 17)"},"sessionId":null}
info: <-- POST /wd/hub/session 500 602.264 ms - 220

Just run Android SDK Manager and install it.
https://github.com/appium/appium/issues/4035

我的这个问题解决了,只需要安装一下 API 17 就能解决这个问题

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册