Macaca 安装 app-inspector 2.0 版本后,连接真机,启动报语法错误

mumu · 2018年02月26日 · 最后由 我去催饭 回复于 2018年02月26日 · 2077 次阅读

安装 macaca-android 时,报无 apk 的错误,此问题解决后,安装 app-inspector 2.0 版本后,连接真机,启动报语法错误,信息如下:

C:\Users\Qian>app-inspector -u 9963d01d --verbose

server.js:16:12 [master] pid:7376 server start with config:
{ port: 5678,
verbose: true,
udid: '9963d01d',
ip: '192.168.179.1',
host: 'DESKTOP-IC7GM4G',
loaded_time: '2018-02-26 16:00:04' }
app-inspector.js:43:12 [master] pid:7376 server start at: http://192.168.179.1:5678
uiautomator-client.js:62:14 [master] pid:7376 INSTRUMENTATION_STATUS: numtests=1
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:7376 INSTRUMENTATION_STATUS: stream=
UIAutomatorWD->http://localhost:9005<-UIAutomatorWD
INSTRUMENTATION_STATUS_CODE: 0

UIAutomatorWD http server ready
Android device started: 9963d01d
inspector start at: http://192.168.179.1:5678
uiautomator-client.js:62:14 [master] pid:7376 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 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:1886)

INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: test=MacacaTestRunner
INSTRUMENTATION_STATUS: class=com.macaca.android.testing.UIAutomatorWD
INSTRUMENTATION_STATUS: stack=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 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:1886)

INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS_CODE: -2
INSTRUMENTATION_RESULT: stream=

Time: 0.07
There was 1 failure:
1) 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 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:1886)

FAILURES!!!
Tests run: 1, Failures: 1

INSTRUMENTATION_CODE: -1

有遇到这个问题的吗?如何解决的?

共收到 2 条回复 时间 点赞
mumu #1 · 2018年02月26日 Author

macaca doctor 信息:
More information: https://macacajs.github.io/changelog.html

macaca-doctor version: 2.0.5

Node.js checklist:

node env: D:\nodejs\node.exe
node version: v6.10.2 lower than v8.9.2

Android checklist:

JAVA version is 1.8.0_131
JAVA_HOME is set to D:\Java\jdk1.8.0_131
ANDROID_HOME is set to D:\android-sdk-windows
Platforms is set to D:\android-sdk-windows\platforms\android-26
ADB tool is set to D:\android-sdk-windows\platform-tools\adb.exe
GRADLE_HOME is set to C:\Gradle\gradle-3.5

Installed driver list:

android: 2.0.46
chrome: 1.0.7

Json 解析错误?
{ port: 5678,
verbose: true,
udid: '9963d01d',
ip: '192.168.179.1',
host: 'DESKTOP-IC7GM4G',
loaded_time: '2018-02-26 16:00:04' }
Macaca 不懂啊,这个 json 解析就过不去

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