在我的testdemo中,我使用了jacoco并且覆盖成功。
演示 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
安卓工作室:0.8.2
最佳答案
在我的例子中,这是通过使用尚未 root 的设备生成的。您是否尝试过在模拟器上运行测试?
关于android gradle 使用 jacoco,获取 "Error during Sync: Remote object doesn' t 存在!”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24884349/