【问题标题】:Cannot set the value of read-only property 'classDirectories' for task '...' of type org.gradle.testing.jacoco.tasks.JacocoReport无法为 org.gradle.testing.jacoco.tasks.JacocoReport 类型的任务“...”设置只读属性“classDirectories”的值
【发布时间】:2020-09-18 15:40:40
【问题描述】:

我刚刚使用新版本的 Gradle 将我的 Android Studio 更新到 4.0,现在我的构建出现错误。

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

到目前为止一直运行良好,我不知道要更改什么才能使其再次运行。

【问题讨论】:

    标签: android android-gradle-plugin build.gradle


    【解决方案1】:

    【讨论】:

    • 这个文件在哪里
    • 这是 gradle 所做的愚蠢的非向后兼容更改。我在 PC 上有一个 gradle 版本,在我的 IDE 上有另一个。看来我现在必须匹配他们的版本了。
    【解决方案2】:

    您需要从 classDirectories = SOME_DIRS 更改为 getClassDirectories().setFrom(SOME_DIRS)

    适用于 Gradle 6.1.1

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-09-29
      • 1970-01-01
      • 2018-01-31
      • 1970-01-01
      • 1970-01-01
      • 2020-01-02
      • 2013-02-26
      相关资源
      最近更新 更多