Gradle sync failed: Could not create parent directory for lock file

冷暖自知 提交于 2020-06-01 01:01:52

问题


I checked out a git repository in android studio, but I'm in trouble with Gradle sync failed error.

When project wants to build, the android studio raise an error like as following:

Gradle sync failed: Could not create parent directory for lock file 
C:\Users\Mohammad\.gradle\wrapper\dists \gradle-4.10.1- 
all\455itskqi2qtf0v2sja68alqd\gradle-4.10.1-all.zip.lck
  • I saw some answers to the other almost same problems, but none of them help.
  • Also I deleted cashes in .gradle directory according above path, but it does not work.

How can I solve this problem?

I appreciate you to solve this problem, thanks.


回答1:


I found this answer:

  1. In the upper-right corner of android studio click on the Gradle tool, then right click on the your project name then click on the Refresh Gradle project as following:

  1. Then click on the Build -> Rebuild Project as following:




回答2:


Run this following command:

gradlew clean
gradlew assembleDebug

If this does not work use following command.

gradlew --update-locks assembleDebug


来源:https://stackoverflow.com/questions/56450134/gradle-sync-failed-could-not-create-parent-directory-for-lock-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!