I'm using JaCoCo to measure unit test coverage in my Android project. While analyzing the report, I noticed that the code coverage for my classes is being grouped under the default package instead of their respective package names.
Here’s the coverage report screenshot:
[![]1](https://gamingcommission.club/i.sstatic.net/pzupgcyf.png)
As you can see, the coverage for some classes is displayed under the default element. This causes confusion because it doesn't reflect the actual package structure of the project.
tasks.register("jacocoCoverage", JacocoReport) {
description = "Calculate code coverage using JaCoCo"
group = "verification"
dependsOn(tasks.named("testStageDebugUnitTest"))
executionData(fileTree(dir: "$buildDir", includes: ["**/*.exec"]))
sourceDirectories.setFrom(files(
"$projectDir/src/main/java"
))
classDirectories.setFrom(fileTree(dir: "$buildDir/tmp/kotlin-classes", includes: [
"stageDebugUnitTest/**/*.class"
]))
reports {
xml.required.set(true)
html.required.set(true)
csv.required.set(false)
html.outputLocation.set(file("$buildDir/jacoco/html"))
xml.outputLocation.set(file("$buildDir/jacoco/jacoco.xml"))
}}
Why is JaCoCo grouping code coverage under default instead of their actual packages? How can I fix this issue so that the coverage report properly reflects the package structure?