0

I am trying to generate jacoco reports, but I keep getting an error when I set the testCoverageEnabled property to true.

java.lang.NoSuchMethodError: No static method $jacocoInit()[Z in class L...

Removing the testCoverageEnabled property I can run the tests but I can not generate reports.

I am using standard Jacoco configurations. Unit tests and integration tests run properly when run independently.

All online references to this issue seem to be specific configuration issues within projects. Any help is appreciated.

Update

apply plugin: 'jacoco'

task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {

    reports {
        xml.enabled = true
        html.enabled = true
    }

    def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
    def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
    def mainSrc = "${project.projectDir}/src/main/java"

    sourceDirectories = files([mainSrc])
    classDirectories = files([debugTree])
    executionData = fileTree(dir: "$buildDir", includes: [
            "jacoco/testDebugUnitTest.exec",
            "outputs/code-coverage/connected/*coverage.ec"
    ])
}
abs
  • 640
  • 2
  • 8
  • 19

0 Answers0