Appium appium 调用不起程序,请大神看看什么问题

manland23 · 发布于 2017年09月11日 · 最后由 chaos 回复于 2017年09月14日 · 最后更新自管理员 Lihuazhang · 360 次阅读

手机自带的计算器没有问题,但是用Selendroid的就不行,下面是我的一些配置

appium这个没有配置,有影响的吗


报错显示这个


这个是基本的代码

大神你看看是哪里出错了

[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","BH90W67E0D","shell","dumpsys","window"]
[AndroidDriver] Screen already unlocked, doing nothing
[Selendroid] Starting selendroid server with instrumentation: selendroid.com.kuparts.service/io.selendroid.server.ServerInstrumentation
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","BH90W67E0D","shell","am","instrument","-e","main_activity","com.kuparts.home.MainActivity","selendroid.com.kuparts.service/io.selendroid.server.ServerInstrumentation"]
[ADB] Error: Unknown exception during instrumentation. Original error android.util.AndroidException: INSTRUMENTATION_FAILED: selendroid.com.kuparts.service/io.selendroid.server.ServerInstrumentation

    at Object.wrappedLogger.errorAndThrow (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13)
    at ADB.callee$0$0$ (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\adb-commands.js:671:9)
    at tryCatch (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
    at process._tickCallback (internal/process/next_tick.js:103:7)
 Error: Unknown exception during instrumentation. Original error android.util.AndroidException: INSTRUMENTATION_FAILED: selendroid.com.kuparts.service/io.selendroid.server.ServerInstrumentation

    at Object.wrappedLogger.errorAndThrow (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13)
    at ADB.callee$0$0$ (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\adb-commands.js:671:9)
    at tryCatch (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
    at process._tickCallback (internal/process/next_tick.js:103:7)
[Selendroid] Deleting Selendroid session
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","BH90W67E0D","shell","am","force-stop","com.kuparts.service"]
[Logcat] Stopping logcat capture
[MJSONWP] Encountered internal error running command: Error: Unknown exception during instrumentation. Original error android.util.AndroidException: INSTRUMENTATION_FAILED: selendroid.com.kuparts.service/io.selendroid.server.ServerInstrumentation

    at Object.wrappedLogger.errorAndThrow (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13)
    at ADB.callee$0$0$ (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\adb-commands.js:671:9)
    at tryCatch (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
    at process._tickCallback (internal/process/next_tick.js:103:7)
[HTTP] <-- POST /wd/hub/session 500 18555 ms - 326
共收到 19 条回复
110
  1. 不要用截图,不方便排查问题
  2. 把日志里面 adb 运行的 instrument 的命令自己手动运行看看,错误堆栈抛的不好,看不出啥来。
0a57a5
110Lihuazhang 回复

好的,我改了日志,报错是这个INSTRUMENTATION_FAILED: selendroid.com.kuparts.service/io.selendroid.server.ServerInstrumentation
是app包有问题吗

110
0a57a5manland23 回复

[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","BH90W67E0D","shell","am","instrument","-e","main_activity","com.kuparts.home.MainActivity","selendroid.com.kuparts.service/io.selendroid.server.ServerInstrumentation"]

try running adb -P 5037 -s BH90W67E0D shell am instrument -e main_activity com.kuparts.home.MainActivity selendroid.com.kuparts.service/io.selendroid.server.ServerInstrumentation

0a57a5
110Lihuazhang 回复

要怎么操作吗

0a57a5

谢谢各位@Lihuazhang @chenhengjie123 @xdf @codeskyblue,定位一下什么问题

110
0a57a5manland23 回复

都和你说了,你要自己思考下呀。

0a57a5
110Lihuazhang 回复

真心不知道啊,哥们

5800
0a57a5manland23 回复

恒温给你解释了啊!

adb -P 5037 -s BH90W67E0D shell am instrument -e main_activity com.kuparts.home.MainActivity selendroid.com.kuparts.service/io.selendroid.server.ServerInstrumentation
0a57a5
5800Edu_taluo 回复

就是看不懂这个啊

5800
0a57a5manland23 回复

增加这些参数

605

INSTRUMENTATION_FAILED: selendroid.com.kuparts.service/io.selendroid.server.ServerInstrumentation

顺着这个方向 stackoverflow 一下吧。

另外,除非是要在 android 4.3 以下或者其它特殊需求,automationName 建议不要设为 selendroid 。

0a57a5
5800Edu_taluo 回复

谢谢,查了好多资料,试了几次都还不行,能不能直接说要增加哪些参数,名称是什么啊

0a57a5
605chenhengjie123 回复

谢谢回复啊,automationName设成appium或者不设也都不行,你说的那个方向还是没有头绪,小白一个,直接指明方向吧🙏

605
0a57a5manland23 回复

不行具体是什么?

你这个问题是比较特定的问题,说实话我没有遇到过,所以很难给出完整的解决方案,只能根据经验和了解给你指一下方向。需要你提供足够齐全的信息。单纯的 “不行”、“失败” 很难帮你定位问题。

0a57a5
605chenhengjie123 回复

报错就是跟前面的一样
Encountered internal error running command: Error: Unknown exception during instrumentation. Original error android.util.AndroidException: INSTRUMENTATION_FAILED: selendroid.com.kuparts.service/io.selendroid.server.ServerInstrumentation
配置的参数是有遗漏吗,但是我查了那么多资料,不知道还需要补什么

Bdc231

你的activity 参数错误。请获取正确activity

0a57a5
Bdc231chaos 回复

换了几个avtivity试了下,报这个股错误了,请问下是什么问题
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","BH90W67E0D","shell","ls","/data/local/tmp/b395c64d068b6ee53e77d5c414b0fb85.apk"]
[AndroidDriver] Checking if app is installed
[ADB] Getting install status for com.kuparts.shop
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","BH90W67E0D","shell","pm","list","packages","com.kuparts.shop"]
[ADB] App is installed
[AndroidDriver] Apk is already on remote and installed, resetting
[AndroidDriver] Running fast reset (stop and clear)
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","BH90W67E0D","shell","am","force-stop","com.kuparts.shop"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","BH90W67E0D","shell","pm","clear","com.kuparts.shop"]
[ADB] Getting install status for selendroid.com.kuparts.shop
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","BH90W67E0D","shell","pm","list","packages","selendroid.com.kuparts.shop"]
[ADB] App is installed
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","BH90W67E0D","shell","dumpsys","window"]
[AndroidDriver] Screen already unlocked, doing nothing
[Selendroid] Starting selendroid server with instrumentation: selendroid.com.kuparts.shop/io.selendroid.server.ServerInstrumentation
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","BH90W67E0D","shell","am","instrument","-e","main_activity","com.kuparts.module.home.activity.GuidePageActivity","selendroid.com.kuparts.shop/io.selendroid.server.ServerInstrumentation"]
[Selendroid] Waiting for Selendroid to be online...
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8080/wd/hub/status] with no body
[Selendroid] Deleting Selendroid session
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","BH90W67E0D","shell","am","force-stop","com.kuparts.shop"]
[Logcat] Stopping logcat capture
[MJSONWP] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: Error: read ECONNRESET
at JWProxy.proxy$ (C:\Users\shihongxia\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:153:13)

Bdc231
1.你是H5测试吗?我看你的 automationName = "selendroid".你可以改为"appium" 感觉你的驱动有问题
2.还有,请展示你的activity 方便定位问题。我看你的activity 格式本身就不对。你5.1 的android系统不应该是你写的那种activity
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册