android - Gradle 配置缓存在本地计算机上有效,但在 GitHub Actions 上失败

标签 android gradle continuous-integration github-actions gradle-configuration-cache

gradle.properties中我设置

org.gradle.unsafe.configuration-cache=true

这在我的本地计算机上运行没有错误。输出为:

0 problems were found storing the configuration cache.

当我在 GitHub Actions 上设置作业时,只有停用配置缓存,它才会成功。 当它被激活时,我得到这个日志:

3 problems were found storing the configuration cache, 1 of which seems unique.
- Task `:app:buildKotlinToolingMetadata` of type `org.jetbrains.kotlin.gradle.tooling.BuildKotlinToolingMetadataTask$FromKotlinExtension`: invocation of 'Task.project' at execution time is unsupported.
  See https://docs.gradle.org/7.4.2/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution

See the complete report at file:///home/runner/work/***/***/build/reports/configuration-cache/3lar58wlvtv9703t0m3olblg9/gwoz69d8l961obatzzelsv4d/configuration-cache-report.html

> Invocation of 'Task.project' by task ':app:buildKotlinToolingMetadata' at execution time is unsupported.

我的主要兴趣是为什么它的行为不同。

我还想知道最好的解决方法是什么。 (可以从缓存中跳过任务吗?或者如何停用 CI 服务器上的配置缓存?)

最佳答案

我还没明白原因。

我当前的解决方法是禁用 CI 构建上的配置缓存,将选项 --no-configuration-cache 添加到所有 gradle 命令中,例如

./gradlew test --no-configuration-cache

这会覆盖 gradle.properties 的设置。

关于android - Gradle 配置缓存在本地计算机上有效,但在 GitHub Actions 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73497571/

相关文章:

java - Noclassdeffounderror - 找不到 v7 支持(android studio)

amazon-web-services - 我的 CloudWatch Event 规则不会触发我的 CodePipeline 管道

android - SDK 管理器无法获取内容 - 与 https ://dl-ssl. google.com 的连接被拒绝

java - 处理水平滚动

android - 在Android Gradle中订购库

maven - 在Gradle中过滤存储库的依赖项查找

continuous-integration - 在 drone.io 中的步骤之间共享变量

asp.net-mvc - 设置 Azure 持续部署时出错

android:靠近脸时关闭屏幕

android - 是否可以向 MaterialDateRange Picker 添加页脚?