gradle 中止时无法锁定文件哈希缓存

Cannot lock file hash cache when gradle was aborted

我取消了 运行 Gradle 构建,现在每当我重新启动它时都会收到以下消息:

Could not create service of type FileHasher using BuildSessionServices.createFileHasher().
   > Cannot lock file hash cache (/data/.gradle/6.4.1/fileHashes) as it has already been locked by this process.

解决方案是寻找 gradle 进程并杀死它。在我的例子中,我不得不寻找一个 运行 java 过程。

所以在htop中我搜索了java并终止了它。那解决了我的问题。

尝试 运行(如果 gradle 安装在您的机器上和 PATH 中)

gradle --stop

./gradlew --stop

在你的项目目录中 从命令行。为我工作。

运行

gradlew --stop 

在 Windows

的终端中

对于 Mac 用户 运行

./gradlew --stop 

从您项目的根目录