我正在通过WiFi通过ADB运行仪器测试,并且经常在运行一定比例的总测试后遇到未找到的设备。我使用./gradlew cAT
执行测试,我不确定执行这些测试时发生的两件事:
cAT
任务需要在执行测试时卸载应用程序?我似乎无法找到有关cAT
同样,我从Android Studio(v1.5.1)运行这些测试,如下所示:
$ ./gradlew --stacktrace cAT
这是异常堆栈跟踪:
my.app.unittest.ivtapp.MyUnitTest > test016_CameraShootPhoto[142: cameraType:XYX ; setting:ISO ; precondition:MANUAL; input1: 7; expected1: 7; input2: -1; expected2: -1][SM-T230NU - 4.4.2] FAILED
Test failed to run to completion. Reason: 'Test run failed to complete. Expected 30896 tests, received 4737'. Check device logcat for details
Tests on SM-T230NU - 4.4.2 failed: Test run failed to complete. Expected 30896 tests, received 4737
Unable to uninstall my.app.unittest.ivtapp.MyUnitTest
com.android.ddmlib.InstallException: device 'X.Y.X.T:5555' not found
at com.android.ddmlib.Device.uninstallPackage(Device.java:1199)
at com.android.builder.testing.ConnectedDevice.uninstallPackage(ConnectedDevice.java:124)
at com.android.builder.internal.testing.SimpleTestCallable.uninstall(SimpleTestCallable.java:260)
at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:242)
at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:48)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.ddmlib.AdbCommandRejectedException: device 'X.Y.X.T:5555' not found
at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:862)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:451)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:382)
at com.android.ddmlib.Device.executeShellCommand(Device.java:613)
at com.android.ddmlib.Device.uninstallPackage(Device.java:1193)
... 10 more
FAILURE: Build failed with an exception.
* What went wrong:
Could not receive a message from the daemon.
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.launcher.daemon.client.DaemonConnectionException: Could not receive a message from the daemon.
at org.gradle.launcher.daemon.client.DaemonClientConnection.receive(DaemonClientConnection.java:85)
at org.gradle.launcher.daemon.client.DaemonClientConnection.receive(DaemonClientConnection.java:35)
at org.gradle.launcher.daemon.client.DaemonClient.monitorBuild(DaemonClient.java:194)
at org.gradle.launcher.daemon.client.DaemonClient.executeBuild(DaemonClient.java:162)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:125)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:80)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: org.gradle.messaging.remote.internal.MessageIOException: Could not read message from '/0:0:0:0:0:0:0:1:56078'.
at org.gradle.messaging.remote.internal.inet.SocketConnection.receive(SocketConnection.java:84)
at org.gradle.launcher.daemon.client.DaemonClientConnection.receive(DaemonClientConnection.java:79)
... 31 more
Caused by: java.io.StreamCorruptedException: invalid stream header: 06000001
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:804)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
at org.gradle.internal.io.ClassLoaderObjectInputStream.<init>(ClassLoaderObjectInputStream.java:27)
at org.gradle.messaging.remote.internal.Message$ExceptionReplacingObjectInputStream.<init>(Message.java:208)
at org.gradle.messaging.remote.internal.Message.receive(Message.java:56)
at org.gradle.internal.serialize.BaseSerializerFactory$ThrowableSerializer.read(BaseSerializerFactory.java:148)
at org.gradle.internal.serialize.BaseSerializerFactory$ThrowableSerializer.read(BaseSerializerFactory.java:146)
at org.gradle.launcher.daemon.protocol.DaemonMessageSerializer$LogEventSerializer.read(DaemonMessageSerializer.java:204)
at org.gradle.launcher.daemon.protocol.DaemonMessageSerializer$LogEventSerializer.read(DaemonMessageSerializer.java:180)
at org.gradle.internal.serialize.DefaultSerializerRegistry$TaggedTypeSerializer.read(DefaultSerializerRegistry.java:85)
at org.gradle.launcher.daemon.protocol.DaemonMessageSerializer$OutputMessageSerializer.read(DaemonMessageSerializer.java:292)
at org.gradle.launcher.daemon.protocol.DaemonMessageSerializer$OutputMessageSerializer.read(DaemonMessageSerializer.java:278)
at org.gradle.internal.serialize.DefaultSerializerRegistry$TaggedTypeSerializer.read(DefaultSerializerRegistry.java:85)
at org.gradle.internal.serialize.Serializers$StatefulSerializerAdapter$1.read(Serializers.java:36)
at org.gradle.messaging.remote.internal.inet.SocketConnection.receive(SocketConnection.java:77)
... 32 more