android gradle使用jacoco,获取“同步时出错:远程对象不存在!”

时间:2014-07-22 10:01:34

标签: android code-coverage jacoco

在我的testdemo中,我使用jacoco并获得覆盖成功。

demo build.gradle

android {
    jacoco {
        toolVersion "0.7.1.201405082137"
}
    buildTypes {
        debug {
            testCoverageEnabled true
        }
    }
}

但在我的其他项目中,我收到了错误:

Tests on Google Nexus 4 - 4.3 - API 18 - 768x1280 - 4.3 failed: Instrumentation run failed due to 'java.lang.VerifyError'
05:43:43 E/Device: Error during Sync: Remote object doesn't exist!
null
java.io.IOException: Failed to pull /data/data/xx/coverage.ec from device
    at com.android.builder.testing.ConnectedDevice.pullFile(ConnectedDevice.java:115)
    at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:158)
    at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:42)
    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.SyncException: Remote object doesn't exist!
    at com.android.ddmlib.SyncService.pullFile(SyncService.java:314)
    at com.android.ddmlib.Device.pullFile(Device.java:873)
    at com.android.builder.testing.ConnectedDevice.pullFile(ConnectedDevice.java:108)
    ... 8 more
:app:connectedAndroidTest FAILED

FAILURE: Build failed with an exception.

操作系统:ubuntu 14.04

gradle:1.11

android-studio:0.8.2

1 个答案:

答案 0 :(得分:1)

在我的情况下,这是通过使用没有root的设备生成的。您是否尝试在模拟器上运行测试?