Appium 每次都需要重新安装应用才能执行下去,不重新安装报 A new session could not be created.

dadda · 2016年11月06日 · 最后由 bingley 回复于 2017年03月26日 · 1778 次阅读

问题描述:

首次安装应用可以成功执行脚本,但是以非重新安装 apk 方式启动 appium,会报 LauncherActivity 未启动导致的 session 创建失败,应该和首页的新手教程有关,重新安装的时候有新手教程,可以正常启动,非全新安装进去的时候没有新手教程,所以会失败,但是不知道该怎么改!
具体日志信息如下,希望了解的朋友可以帮个忙,非常感谢!!!

日志信息:

info: [debug] Waiting for pkg "com.tianqi.tqweather" and activity "com.tianqi.tqweather.LauncherActivity" to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: D:\android-sdk\platform-tools\adb.exe -s 71UBBLJ229
93 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: D:\android-sdk\platform-tools\adb.exe -s 71UBBLJ229
93 shell "dumpsys window windows"

error: Failed to start an Appium session, err was: Error: com.tianqi.tqweather/.La
uncherActivity never started. Current: com.tianqi.tqweather/.MainActivity
info: [debug] Error: com.tianqi.tqweather/.LauncherActivity never started. Current
: com.tianqi.tqweather/.MainActivity
    at [object Object].<anonymous> (D:\Program Files\Appium\node_modules\appium\
node_modules\appium-adb\lib\adb.js:1314:12)
    at [object Object].<anonymous> (D:\Program Files\Appium\node_modules\appium\
node_modules\appium-adb\lib\adb.js:1258:7)
    at [object Object].<anonymous> (D:\Program Files\Appium\node_modules\appium\
node_modules\appium-adb\lib\adb.js:180:9)
    at ChildProcess.exithandler (child_process.js:204:7)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:827:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"
A new session could not be created. (Original error: com.tianqi.tqweather/.Launche
rActivity never started. Current: com.tianqi.tqweather/.MainActivity)","origValue"
:"com.tianqi.tqweather/.LauncherActivity never started. Current: com.tianqi.tqweather/.MainActivity"},"sessionId":null}
info: <-- POST /wd/hub/session 500 28590.155 ms - 308
共收到 3 条回复 时间 点赞

错误信息不是提示了吗
Error: com.tianqi.tqweather/.La
uncherActivity never started. Current: com.tianqi.tqweather/.MainActivity

在 appium 的设置里把 “override existing session” 的选项勾上,重启一下 appium 就好了

小阿飞 回复

1.6.4 怎么勾选这项啊?

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