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

£可爱£侵袭症+ 提交于 2020-11-28 03:52:35

问题


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.

This is the file jacoco.gradle : https://pastebin.com/PHZxvMMP

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


回答1:


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




回答2:


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

Works OK with Gradle 6.1.1



来源:https://stackoverflow.com/questions/62113575/cannot-set-the-value-of-read-only-property-classdirectories-for-task-of

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!