I'm working in a multi-module Android project. If I simply add
apply plugin: 'jacoco'
jacoco {
toolVersion '0.8.7'
}
to the build.gradle for each module, then when I run the off-device unit tests from the command line in each module's directory, I see an .exec file created at build/jacoco/testDebugUnitTest.exec with a size of ~27k or so. Generating a report from this does what I'd expect.
If I add
buildTypes {
debug {
testCoverageEnabled true
}
}
to the build.gradle for each module (so that I can later also gather coverage for on-device tests) then when I run the off-device unit tests the .exec file is instead created in build/outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec.
More importantly, however, while that file is ~27k when I'm running the tests in the application module, it is almost empty (only 45 bytes) when I'm running the tests in a library module in the same project.
Is there a reason testCoverageEnabled interferes with off-device code coverage for library modules but not for the primary application module?)