# Use jacoco in android library Module

**URL:** <https://discuss.gradle.org/t/use-jacoco-in-android-library-module/19468>\
**Category:** Help/Discuss\
**Created:** [September 12, 2016, 9:40am UTC](https://discuss.gradle.org/t/use-jacoco-in-android-library-module/19468 "2016-09-12T09:40:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zz061945](https://avatars.discourse-cdn.com/v4/letter/z/51bf81/32.png) [@zz061945](https://discuss.gradle.org/u/zz061945)\
**Post date:** [September 12, 2016, 9:40am UTC](https://discuss.gradle.org/t/use-jacoco-in-android-library-module/19468/1 "2016-09-12T09:40:46Z")

</div>

I write some JUnit test for an Android Library Module, then I wanna use jacoco plugin to get code coverage, my build.gradle like below:

```gradle
apply plugin 'com.android.library'
apply plugin 'jacoco'
......
android{
buildTypes {
        debug {
            testCoverageEnabled true
        }
    }
}

tast coverageReport(type: 'JacocoReport'){
  executionData = files('build/jacoco/testDebugUnitTest.exec')
    sourceDirectories = files('src/main/java')
    classDirectories = fileTree(dir: 'build/intermediates/classes/debug',
            excludes: ['**/R.class',
                       '**/R$*.class',
                       '**/BuildConfig.*',
            ]
    )
    reports {
        xml.enabled = true
        html.enabled = true
    }
}

```

then I run the test task and coverageReport task:

```gradle
gradle clean test
gradle coverageReport

```

At last, I got a Exception:

```gradle
Incremental java compilation is an incubating feature.
:myLibrary:coverageReport FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':myLibrary:coverageReport'.
> org/jacoco/core/analysis/ICoverageNode

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

BUILD FAILED

```

My gradle version is 2.1.0, android gradle plugin version is 2.10.0, jacoco agent version is 0.7.1.201405082137  
What’s wrong with my config?Anyone can help me, thx
