Android library module: .exec near-empty when testDebugCoverage is true

197 views
Skip to first unread message

Aidan Low

unread,
Dec 13, 2021, 12:03:52 PM12/13/21
to JaCoCo and EclEmma Users
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?)

Rodrigo Vieira

unread,
Jun 2, 2022, 5:25:25 PM6/2/22
to JaCoCo and EclEmma Users
I'm also getting this problem.

Have you find a solution?

聂超群

unread,
Jun 15, 2022, 11:30:15 PM6/15/22
to JaCoCo and EclEmma Users
I'm also getting this problem :(
Jacoco coverage showed 0%

Reply all
Reply to author
Forward
0 new messages