Jacoco has a known bug that results in no coverage generation when buildType.debug.testCoverageEnabled is set to true. With this option set to false, gradle does not find the task 'createDebugCoverageReport which is used to run instrumentation tests with coverage reporting. These tests contribute to a fraction of the
test coverage.
Below is the difference especially in the sample module where the tests are mostly instrumentation tests
Before
This issue came up after updating AGP in this PR
Reduced coverage by 10%
buildType.debug.testCoverageEnabled
is set totrue
. With this option set to false, gradle does not find the task'createDebugCoverageReport
which is used to run instrumentation tests with coverage reporting. These tests contribute to a fraction of the test coverage.Below is the difference especially in the
Before
sample
module where the tests are mostly instrumentation tests