Search code examples
androidandroid-gradle-pluginjacocogradle-kotlin-dsljacoco-plugin

Upgrade to AGP 4.2.0 ,unable to generate Jacoco code coverage report


Jacoco code coverage was working fine till I upgrade Android Gradle Plugin to 4.2.0 , no only app module code coverage getting generated, for modules it is not working. Any Idea how to fix this issue.


Solution

  • I was having the same problem after upgrading to 4.2.1.

    It looks like the Jacoco execution data file for non-instrumented unit tests has been renamed to 'jacoco.exec', and moved to the module's top-level directory.

    In the configuration of my JacocoReport gradle task, this works for me:

    executionData.from = "${project.projectDir}/jacoco.exec"
    

    NOTE: The execution data file for instrumented tests has not been renamed or moved.