Android Gradle: Jacoco error

This tutorial fixes Jacoco 4.6 issues when updating to Gradle 4.0.1 and wrapper 6.6.1.

Cannot set the value of read-only property 'executionData' for task ':client:jacocoTestFlavorDebugUnitTestReport' of type org.gradle.testing.jacoco.tasks.JacocoReport.

In the last version something is broken between Jacoco’s gradle plugin and Gradle, thanks to this fork for the solution. With Jacoco and Gradle we generate a test code coverage report for our Android project, shows the percentage of unit tests coverage. If we configure Codecov we can add our unit test coverage badge to our GitHub repo

Fix Jacoco build error Inside build.gradle:

  1. Replace:
classpath ‘com.dicedmelon.gradle:jacoco-android:0.1.4’


classpath 'com.hiya:jacoco-android:0.2'
maven { url “" }

2. Replace:

apply plugin: 'jacoco-android'


apply plugin: 'com.hiya.jacoco-android'

In case you have Gradle `error classDirectories` fix with below changes:


classDirectories = fileTree(



Thanks for reading. I started to publish my daily notes. Let me know if I’m wrong somewhere or if there’s something that could do differently or better. I’m open to your feedback 🙌🏻


software engineer, read, swim, travel. apps:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store