Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I just updated my Android Studio to 4.0 with a new version of Gradle, and I now have an error on my build.

Cannot set the value of read-only property 'classDirectories' for task ':app:testNameOfMyFlavorDebugUnitTestCoverage' of type org.gradle.testing.jacoco.tasks.JacocoReport.

It's been working fine so far, I don't know what to change to make it work again.

like image 546
Asue Avatar asked May 31 '20 08:05

Asue


2 Answers

Found the response here : https://docs.gradle.org/current/userguide/upgrading_version_5.html#other_deprecated_behaviors_and_apis

And here : Filter JaCoCo coverage reports with Gradle

For example, classDirectories is replaced by classDirectories.from

like image 95
Asue Avatar answered Oct 22 '22 01:10

Asue


You'll need to change from classDirectories = SOME_DIRS to getClassDirectories().setFrom(SOME_DIRS).

Works OK with Gradle 6.1.1

like image 25
Jing Li Avatar answered Oct 22 '22 03:10

Jing Li