将 gradle 更新到 8.2.1 后,出现配置缓存问题:
这是我的错误:
Configuration cache problems found in this build.
1 problem was found storing the configuration cache.
- Build file 'app/build.gradle.kts': external process started 'git rev-parse --verify --short HEAD'
See https://docs.gradle.org/8.2.1/userguide/configuration_cache.html#config_cache:requirements:external_processes
代码出现此问题:
val gitCommitHash = "git rev-parse --verify --short HEAD".runCommand(workingDir = rootDir)
then try to assign
versionNameSuffix = "-QA ($gitCommitHash)"
我看到了
gradle.properties
的解决方案,但它不起作用。:
org.gradle.unsafe.configuration-cache=true
我认为配置缓存不值得这么麻烦。在 Android Studio 中对我有用,但在构建服务器上不起作用(我真的不在乎构建的持续时间)。
我刚刚停用它,它又开始运行了。
gradle.属性:
org.gradle.configuration-cache=false