jacoco-android-gradle-plugin icon indicating copy to clipboard operation
jacoco-android-gradle-plugin copied to clipboard

Jacoco Task taking forever

Open bschnack opened this issue 6 years ago • 7 comments

The Jacoco Task sometimes takes forever to run. Sometimes, it runs immediately and other times, it just gets stuck doing the same task over and over again. You can see the gradle task in the picture below. The gradle file (slimmed down to important info) looks like: build.gradle Project Level

buildscript {
    dependencies {
        classpath('com.dicedmelon.gradle:jacoco-android:0.1.3') { exclude group: 'org.codehaus.groovy', module: 'groovy-all' }
    }
}

build.gradle App Level

apply plugin: 'jacoco-android'

android {
    testOptions {
        animationsDisabled true
        unitTests {
            includeAndroidResources = true
        }
        unitTests.all {
            jvmArgs '-noverify'
            jacoco {
                includeNoLocationClasses = true
            }
        }
    }
}

jacocoAndroidUnitTestReport {
    csv.enabled true
    html.enabled false
    xml.enabled false
}

image

bschnack avatar Feb 23 '19 00:02 bschnack

@bschnack could you try again with 0.1.4?

arturdm avatar Feb 27 '19 13:02 arturdm

So far that seems to have worked. However, we still see that the Jacoco task takes a while to run. Is there a way to only have it run with a certain command line argument or improve that time?

Thanks, Brian

image

bschnack avatar Mar 01 '19 16:03 bschnack

I am seeing similar behavior with 0.1.4. It only happens intermittently but occasionally I'll the jacocoDevDebug job running for 5 to 10 minutes.

hoda0013 avatar Nov 05 '19 22:11 hoda0013

I've tried below approach:

  1. gradle.startParameter.excludedTaskNames += "jacocoDevelopDebug" in custom task, or overwriting it, e.g:
// kotlin gradle
task.replace("assemble[Flavour]Debug").doLast { 
   gradle.startParameter.excludedTaskNames += "jacoco[Flavour]Debug"
}

// groovy gradle
task jar(overwrite: true) {
   gradle.startParameter.excludedTaskNames += "jacoco[Flavour]Debug"
}

See original issue here & here (about kotlin gradle)


  1. Using parameter in command line, e.g:
./gradlew -PnoLint
// or
./gradlew -x lint

See original article here & here


  1. Flagging based on command line argument & separating jacoco task gradle file
if (System.getProperty("myJacocoArguments").toBoolean()) {
   apply: jacoco.gradle
}

See here for more detail


  1. Disable test coverage on local development, and run only on jenkins/CI server
        testCoverageEnabled (project.hasProperty('coverage') ? true : false)

Original article

mochadwi avatar Mar 08 '20 15:03 mochadwi

This is happening to me, but I'm not even using this plugin. I'm using https://github.com/vanniktech/gradle-android-junit-jacoco-plugin

nateridderman-lilly avatar Mar 26 '20 21:03 nateridderman-lilly

This is still happening for 50 per cent of the build. Any way to fix this or to get rid of the plugin all together?

pp-lucaal-sportsbet avatar Nov 23 '20 03:11 pp-lucaal-sportsbet

Unfortunately this issue is still happening. Has anyone been able to find a workaround?

Sinapse87 avatar Jan 10 '21 23:01 Sinapse87