Macaca app-inspector 连接安卓真机出错 Internal Server Error

jojotester · 2017年12月28日 · 最后由 达峰的夏天 回复于 2018年03月07日 · 1812 次阅读

macaca doctor 信息

macaca doctor

  macaca-doctor version: 2.0.4


  Node.js checklist:

  node env: D:\soft\nodejs\node.exe
  node version: v8.9.1

  Android checklist:

  JAVA version is `1.8.0_121`
  JAVA_HOME is set to `D:\soft\Java\jdk`
  ANDROID_HOME is set to `D:\soft\Android\android-sdk`
  Platforms is set to `D:\soft\Android\android-sdk\platforms\android-27`
  ADB tool is set to `D:\soft\Android\android-sdk\platform-tools\adb.exe`
  GRADLE_HOME is set to `D:\soft\gradle-4.4.1`

  Installed driver list:

  android: 2.0.43
  chrome: 1.0.7

app-inspector 出错日志

$ app-inspector -u 501665c8 --verbose
>> server.js:16:12 [master] pid:10864 server start with config:
 { port: 5678,
  verbose: true,
  udid: '501665c8',
  ip: '10.246.1.43',
  host: 'JPC',
  loaded_time: '2017-12-28 17:26:35' }
>> app-inspector.js:43:12 [master] pid:10864 server start at: http://10.246.1.43:5678
>> uiautomator-client.js:62:14 [master] pid:10864 INSTRUMENTATION_STATUS: numtests=1
>> uiautomator-client.js:62:14 [master] pid:10864
INSTRUMENTATION_STATUS: stream=
com.macaca.android.testing.UIAutomatorWD:
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: test=MacacaTestRunner
INSTRUMENTATION_STATUS: class=com.macaca.android.testing.UIAutomatorWD
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS_CODE: 1

>> uiautomator-client.js:62:14 [master] pid:10864 INSTRUMENTATION_STATUS: stream=
>> uiautomator-client.js:62:14 [master] pid:10864
UIAutomatorWD->http://localhost:9001<-UIAutomatorWD
INSTRUMENTATION_STATUS_CODE: 0

>> UIAutomatorWD http server ready
>> Android device started: 501665c8
>> inspector start at: http://10.246.1.43:5678
>> uiautomator-client.js:62:14 [master] pid:10864 INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
Error in MacacaTestRunner(com.macaca.android.testing.UIAutomatorWD):
com.alibaba.fastjson.JSONException: syntax error, expect [, actual undefined, pos 0
        at com.alibaba.fastjson.parser.DefaultJSONParser.parseArray(DefaultJSONParser.java:1103)
        at com.alibaba.fastjson.parser.DefaultJSONParser.parseArray(DefaultJSONParser.java:1090)
        at com.alibaba.fastjson.JSON.parseArray(JSON.java:487)
        at com.macaca.android.testing.UIAutomatorWD.MacacaTestRunner(UIAutomatorWD.java:34)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:27)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
        at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)
        at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262)
        at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1846)
共收到 6 条回复 时间 点赞

我也遇到这个问题了 macaca 好像每次升级了之后都会出问题啊
@xdf

我也是一样的报错,今天刚升级。升级前是 ok 的,希望尽快帮忙解决下@xdf

@jojotester 你问题解决了吗?

先把 app-inspector 的 uiautomatorwd 回退到@1.0.45即可
1.0.47 很多人都反应有问题

TIM&SCHOLA uirecorder 打开手机失败 中提及了此贴 02月07日 10:01

删除%userprofile%\AppData\Roaming\npm\node_modules\app-inspector\node_modules 下边的 uiautomatorwd 文件夹,然后执行:npm i uiautomatorwd@1.0.45 -g

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