When I was using 7.4.1, Java 11 with jacoco verion 0.8.5. it was working. After we upgrade the version to 8.7, Java 17 and jacoco version 0.8.8. i started getting issue. i tried to use 0.8.7 , 0.8.10 jacoco version but it’s still failing. also after changing to 7.r gradle version 8.7 and java lib change property “sonar.java.binaries”, "${project.buildDir}/intermediates/javac/${variant}/classes/com to “sonar.java.binaries”, "${project.buildDir}/intermediates/javac/${variant}/compile${variant}JavaWithJavac/classes/com. we change this in build.gradle and but still coverage is getting 0. report is generated with 0%. but are getting other value but coverage is still 0
It seems your question is more about how to configure SonarQube, so I suggest you ask in the SonarQube community how to configure it.
If you also get 0 coverage in the JaCoCo report generated by the Gradle task, you might need to provide an MCVE that shows your exact situation and problem.
can we connect in google meet to show the error ?
in Jacoco Report i am getting 0 coverage .
**16:27:07** [ant:jacocoReport] Execution data for class com/hike/mazuma/ui/tournament/model/Banner does not match. **16:27:07** [ant:jacocoReport] Execution data for class com/hike/mazuma/databinding/OtherWalletsBottomsheetLayoutBindingImpl does not match. **16:27:07** [ant:jacocoReport] Execution data for class com/hike/mazuma/ui/homeactivity/HomeActivity$getJuspayCallbackAdapter$1 does not match.
below is the task in
apply from: 'dependencies.gradle'
android.applicationVariants.all { variant ->
task("jacoco${variant.name.capitalize()}EspressoTestReport", type: JacocoReport) {
description 'Generate Espresso Jacoco coverage reports after running tests.'
group 'Reporting'
def fileFilter = [
'**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/*$ViewBinder*.*',
'**/BuildConfig.*',
'**/Manifest*.*'
]
classDirectories.from(
fileTree(
dir: "${buildDir}/tmp/kotlin-classes/${variant.name}/com/",
excludes: fileFilter
) +
fileTree(
dir: "${buildDir}/intermediates/javac/${variant.name}/compileObfuscatedJavaWithJavac/classes/com/",
excludes: fileFilter
)
)
sourceDirectories.from(fileTree(
dir: "${project.projectDir}/src/main/java"
)
)
executionData.from(fileTree(dir: "$buildDir", includes: [
"codecoverage/data/*.ec"
])
)
onlyIf = {
true
}
reports {
xml.required.set(true)
csv.required.set(false)
html.required.set(true)
}
}
}
can we connect in google meet to show the error ?
I don’t think you can or want to afford paying me for private personal support.
I’m just a user like you.
Execution data for class … does not match
This afair means that the class JaCoCo instrumented is not the one that is on disk and thus JaCoCo cannot know what was covered and thus reports no coverage.
This often happens when having other agents that also instrument classes that run before the JaCoCo instrumentation.
As I now see you are using Android, afair Android and JaCoCo is always a bit hairy, and I guess you did also update AGP but not mentioning it, so that might be what causes this.
But this is more a topic for JaCoCo or Android, not so much a Gradle issue, so I suggest you ask in some of those communities. One way could for example be to use JaCoCo offline instrumentation, but I have no idea how to do that in an Android project as I’m not into Android development.
this issue came after we updated 8.7 and java 17 gradle version.
And you did not update the Android Gradle Plugin in that course?
Then maybe it just behaves differently with a newer Gradle version.
But still, Android and JaCoCo always had a hard time working together properly as far as I know, there are even specific plugins to improve this afair.
Maybe if you knit an MCVE someone with Android expertise can point to some solution, but you still might be better off asking in some Android community.