I try to exclude some packages from the jacoco report but I don't find any documentation about doing that.
I tried that, but doesn't work:
testOptions {
unitTests {
jacoco {
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: '**/*databinding/**/*.*')
}))
}
}
}
}
I use com.android.tools.build:gradle:8.0.2
and org.jacoco:org.jacoco.core:0.8.8
.
Do you know how to exclude packages from jacoco report?
I don't find any "packaged" solution to solve my issue, so to move forward, I create my own gradle task:
Running
./gradlew jacocoDebugUnitTestCoverageReport
generate a coverage report without excluded packages.If you know a better solution, I would appreciate your sharing.