Setting up an unified coverage report in Android with Jacoco, Robolectric, and Espresso
Rafael Toledo
16425

On Android Gradle plug-in 2.2.0 and above the androidTest execution data is not saved to “coverage.ec” anymore but prefixed with device/AVD name such as “Some fancy AVD-coverage.ec”. The jacocoTestReport task has onlyIf rules to skip the task unless all execution data files are found.

Here’s how I changed this to capture the execution data with 2.2.0:

executionData = fileTree(dir: "$buildDir", includes: [ "jacoco/testDebugUnitTest.exec",
"outputs/code-coverage/connected/*coverage.ec"])