解決AndroidStudio編譯時報錯:Timeout waiting to lock artifact cache .


1、 錯誤描述

今天在Android Studio中,使用gradle命令的時候,出現了如下所示的錯誤:

D:\GitLab Source\XTCLint>gradlew clean uploadArchives --stacktrace
Starting a Gradle Daemon, 1 busy and 1 incompatible Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'XTCLint'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Timeout waiting to lock artifact cache (C:\Users\000\.gradle\caches\modules-2). It is currently in use by another Gradle instance.
     Owner PID: 10736
     Our PID: 204
     Owner Operation: resolve configuration ':classpath'
     Our operation:
     Lock file: C:\Users\000\.gradle\caches\modules-2\modules-2.lock

* Try:
Run with --info or --debug option to get more log output.

這里寫圖片描述

2、 解決錯誤

這里寫圖片描述

選擇【File】–>【Invalidate Caches/Restart】,然后彈出如下所示的彈框

 這里寫圖片描述

選擇【Invalidate and Restart】重啟Android Studio

這里寫圖片描述

點擊【Exit】,發現半天都沒有重啟,下面強制關閉掉 Android Studio 


重啟Android Studio之后,運行gradle命令移入報錯。

這里寫圖片描述

下面使用暴力方法,將上面提示的 C:\Users\000.gradle\caches\modules-2 目錄下的lock文件刪掉

接着重新運行gradle命令,則可以正常運行了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM