I'm trying to make jacoco create a code coverage report for my android test project. I have the following in build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'jacoco'
...
jacoco {
toolVersion = "0.7.1.201405082137"
}
...
android {
buildTypes {
release {
}
debug {
testCoverageEnabled true
}
}
}
when I run gradlew -i createDebugCoverageReport, I get a coverage report, but it's empty. the end of the gradle execution is as follows:
:androidTest:connectedAndroidTest (Thread[main,5,main]) completed. Took 2 mins 36.951 secs.
:androidTest:createDebugCoverageReport (Thread[main,5,main]) started.
:androidTest:createDebugCoverageReport
Executing task ':androidTest:createDebugCoverageReport' (up-to-date check took 0.006 secs) due to:
Output file /home/akos/src/androidTest/build/outputs/reports/coverage/debug has changed.
Output file /home/akos/src/androidTest/build/outputs/reports/coverage/debug/index.html has been removed.
Output file /home/akos/src/androidTest/build/outputs/reports/coverage/debug/.resources/package.gif has been removed.
[ant:reportWithJacoco] Loading execution data file /home/akos/src/androidTest/build/outputs/code-coverage/connected/coverage.ec
[ant:reportWithJacoco] Writing bundle 'debug' with 3 classes
:androidTest:createDebugCoverageReport (Thread[main,5,main]) completed. Took 0.215 secs.
BUILD SUCCESSFUL
Total time: 4 mins 53.467 secs
and indeed, the coverage.ec file referenced above is empty (of 0 length)
in the directory build/intermediates/coverage-instrumented-classes/ , I seem to have the instrumented class files
this is with gradle 2.1
what am I doing wrong?