Jacoco exec file not generated (:jacocoTestReport SKIPPED)

I’m unable to get the .exec file generated when running code coverage on connectedAndroidTest. I’m able to get a code coverage report, even though the last thing that’s printed when I run ‘./gradlew jacocoTestReport’ (or ‘./gradlew connectedAndroidTest jacocoTestReport’) is:

‘’’ :dexAppDebugTest UP-TO-DATE :packageAppDebugTest UP-TO-DATE :assembleAppDebugTest UP-TO-DATE :connectedAndroidTestAppDebug :createAppNewDebugCoverageReport :createAppDebugCoverageReport :connectedAndroidTest UP-TO-DATE :jacocoTestReport SKIPPED

BUILD SUCCESSFUL

Total time: 1 mins 36.719 secs ‘’’

My gradle file for jacoco-related things looks like this:

apply plugin: 'jacoco'
  jacoco {
    toolVersion = "0.7.1.201405082137"
}
  def coverageSourceDirs = [
        'src/main/java/com/app/authentication',
        'src/main/java/com/app/model',
        'src/main/java/com/app/net',
        'src/main/java/com/app/provider',
        'src/main/java/com/app/service',
        'src/main/java/com/app/text',
        'src/main/java/com/app/util'
]
  task jacocoTestReport(type: JacocoReport, dependsOn: "connectedAndroidTest") {
    group = "Reporting"
    description = "Generates Jacoco coverage reports"
      reports {
        xml.enabled = true
        html.enabled = true
    }
      classDirectories = fileTree(
            dir: 'build/intermediates/classes',
            excludes: ['**/R.class',
                       '**/R$*.class',
                       '**/BuildConfig.*',
                       '**/Manifest*.*',
                       '**/*Activity*.*',
                       '**/*Fragment*.*'
            ]
    )
      sourceDirectories = files(coverageSourceDirs)
    additionalSourceDirs = files(coverageSourceDirs)
    executionData = files('build/jacoco/connectedAndroidTest.exec')
}

An xml file and html file are generated in build/outputs/reports/coverage/app/debug, but the exec file is nowhere to be found (even when I try running ‘./gradlew build jacocoTestReport’). I need the exec file to publish the code coverage report on Jenkins.

For anyone facing the same problem, I was looking for an .exec file, but actually, .ec files are produced. I’m able to get the proper published report on Jenkins using the JaCoCo plugin with these fields:

Path to exec files:
    **/**.ec
Path to class directories:
    **/classes
Path to source directories:
    **/src/main/java
Inclusions:
    **/com/app/authentication/**/*, **/com/app/model/**/*, **/com/app/net/**/*, **/com/app/provider/**/*, **/com/app/service/**/*, **/com/app/text/**/*, **/com/app/util/**/*
Exclusions:
    **/R.class, **/R$*.class, **/BuildConfig.*, **/Manifest*.*, **/*Activity*.*, **/*Fragment*.*

@linguine Could you please share your updated gradle file.

My gradle file is the same – the only changes I made were to the Jenkins job, using the fields I specified above. Unfortunately, I still don’t know how to get the report from the command line.