Appium error: Failed to start an Appium session, err was: Error: Parameter 'appPackage' is required for launching application

xxl1989 · 2014年05月14日 · 最后由 回复于 2016年08月14日 · 1707 次阅读

按照网上 appium 的例子 AndroidContactsTest
最后运行时报错 error: Failed to start an Appium session, err was: Error: Parameter 'appPackage' is required for launching application

info: Welcome to Appium v1.0.0 (REV f0a00fab2335fa88cb355ab4dc43a9cd3f3236c0)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: socket.io started
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"desiredCapabilities":{"platform":"WINDOWS
","app":"D:\xxl\java\workspace\my-app-web-two\apps\ContactManager\Contact
Manager.apk","browserName":"","app-package":"com.example.android.contactmanager"
,"device":"Android","app-activity":".ContactManager","version":"4.4"}}
info: No appActivity desired capability or server param. Parsing from apk.
info: No appPackage desired capability or server param. Parsing from apk.
info: Using local app from desired caps: D:\xxl\java\workspace\my-app-web-two\ap
ps\ContactManager\ContactManager.apk
info: Creating new appium session 6aac7045-22d0-4fe9-b805-1402a5ab5b33
info: Starting android appium
debug: Using fast reset? true
info: Preparing device for session
info: Checking whether app is actually present
info: Checking whether adb is present
info: [ADB] Using adb from D:\xxl\java\adt-bundle-windows-x86_64-20140321\sdk\pl
atform-tools\adb.exe
info: Trying to find a connected android device
info: [ADB] Getting connected devices...
debug: executing: "D:\xxl\java\adt-bundle-windows-x86_64-20140321\sdk\platform-t
ools\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:\xxl\java\adt-bundle-windows-x86_64-20140321\sdk\platform-t
ools\adb.exe" -s emulator-5554 wait-for-device
debug: executing: "D:\xxl\java\adt-bundle-windows-x86_64-20140321\sdk\platform-t
ools\adb.exe" -s emulator-5554 shell "echo 'ready'"
info: Starting logcat capture
info: Checking whether aapt is present
info: Getting device API level
debug: executing: "D:\xxl\java\adt-bundle-windows-x86_64-20140321\sdk\platform-t
ools\adb.exe" -s emulator-5554 shell "getprop ro.build.version.sdk"
info: Device is at API Level 19
info: Stopping logcat capture
debug: Logcat terminated with code null, signal SIGTERM
info: Sent shutdown command, waiting for UiAutomator to stop...
warn: UiAutomator did not shut down fast enough, calling it gone
info: Cleaning up android objects
info: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Parameter 'appPackage'
is required for launching application
info: Error: Parameter 'appPackage' is required for launching application
at Android.pushStrings (D:\xxl\java\nodejs\node_modules\appium\lib\devices\a
ndroid\android.js:301:17)
at D:\xxl\java\nodejs\node_modules\appium\node_modules\async\lib\async.js:59
5:21
at D:\xxl\java\nodejs\node_modules\appium\node_modules\async\lib\async.js:23
5:13
at iterate (D:\xxl\java\nodejs\node_modules\appium\node_modules\async\lib\as
ync.js:142:13)
at D:\xxl\java\nodejs\node_modules\appium\node_modules\async\lib\async.js:15
3:25
at D:\xxl\java\nodejs\node_modules\appium\node_modules\async\lib\async.js:23
7:17
at D:\xxl\java\nodejs\node_modules\appium\node_modules\async\lib\async.js:60
0:34
at D:\xxl\java\nodejs\node_modules\appium\lib\devices\android\android.js:266
:5
at D:\xxl\java\nodejs\node_modules\appium\lib\devices\android\adb.js:630:7
at D:\xxl\java\nodejs\node_modules\appium\lib\devices\android\adb.js:154:5
info: Responding to client with error: {"status":33,"value":{"message":"A new se
ssion could not be created. (Original error: Parameter 'appPackage' is required
for launching application)","origValue":"Parameter 'appPackage' is required for
launching application"},"sessionId":null}

POST /wd/hub/session 500 7751ms - 270b

新人求解

共收到 5 条回复 时间 点赞

贴代码, 原因在 log 中已经告诉你了

参数错误,app-package 改成 apppackage,app-activity 改成 appactivity 试试吧

谢谢楼上 2 位,这个问题已经修复了。但是又有新问题了。app 在模拟机上一执行 add contact 就报 “Contact Manager has stopped” 不知道是我下载的 apk 有问题还是我某些配置有问题,真无奈

不一定非要测试 contact 这个 app,你可以自己换个已经安装在机器或模拟器上的 app

appium 怎么连接到 sdk 模拟器呢? 我已经开了模拟器,但是显示连接不上

Launching Appium server with command: D:\Android\Appium\install\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --avd Android4.4.2 --platform-name Android --platform-version 19 --automation-name Appium --device-name "Android Emulator" --log-no-color

info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:4723

info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"avd":"Android4.4.2","deviceName":"Android Emulator","platformName":"Android","platformVersion":"19","automationName":"Appium"}
info: Console LogLevel: debug

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