Gradle 2.14.1 can not read execution data from jacoco 0.7.4


(Nguyen Anh Tuan) #1

Hi everyone,
I know it is an old version of Gradle but I still can not find the answer for my problem for a long time and if you have any idea please help me :slight_smile:
I am using Gradle 2.14.1 to generate coverage report for Android Testcases, and for some reasons I only can use Jacoco 0.7.4 in my project:
buildscript {
configurations.all {
resolutionStrategy {
force 'org.jacoco:org.jacoco.report:0.7.4.201502262128’
force ‘org.jacoco:org.jacoco.core:0.7.4.201502262128’
}
}
}
But when run task generateCoverageReport, I got the error:
"Cannot read execution data version 0x1006. This version of JaCoCo uses execution data version 0x1007."
Anybody know the way to get gradle 2.14.1 (or upper) can read execution data of Jacoco 0.7.4? Please advice.
Thanks so much for your kindly attention.


(Benjamin Muschko) #2

I am not sure if that fixes your issue but you should set the JaCoCo version as described here:

https://docs.gradle.org/current/userguide/jacoco_plugin.html#sec:configuring_the_jacoco_plugin

What exactly prevents you from upgrading to a newer version of Gradle?


(Nguyen Anh Tuan) #3

Hi Benjamin,
I can use Gradle 2.14.1 or any newer versions. However, all of them can not read execution data generated by Jacoco 0.7.4 as my code:
…{
force 'org.jacoco:org.jacoco.report:0.7.4.201502262128’
force ‘org.jacoco:org.jacoco.core:0.7.4.201502262128’
}…
if I use Jacoco 0.7.5 or newer, Gradle will create report normally. But I can’t do it . The reason is my project has a task named “transformClassesWithDexForDebug” which always stuck with Jacoco 0.7.5++.
Please check this topic ( from post #67) for more details:
https://code.google.com/p/android/issues/detail?id=220611
Thanks.


(Benjamin Muschko) #4

I don’t think I fully understand the problem. If your task requires a specific JaCoCo version (BTW: why does dexing require JaCoCo?), then just use the same version when generating code coverage.

jacoco {
    toolVersion = "0.7.5.x"
}