Member-only story
Unlocking the Power of Gradle
Clearing Lock Files from Gradles Caches
Here is a quick one that might help you after a Gradle build that, for some reason, got interrupted.
Gradle builds use locks to ensure that only one process accesses a particular resource at a time. Interrupting a Gradle build can result in lock files being left behind, which prevent subsequent builds from accessing the resources that were being used at the time of interruption.
Now, if the build process gets interrupted, the process may not have had a chance to clean up after itself before it was interrupted, leaving lock files in place that prevent other builds from accessing the resources. Therefore, you won’t be able to run another build.
My Android Studio for example needs a minute or so to detect the first lock file. After I have deleted it by hand, I restart the build and it will take a long while after it reports the existence of yet another lock file. After removing that lock file, the process repeats and repeats until all lock files have been removed.
I am assuming you are only trying to build one project at a time.
There are two directories that needs to be cleared from the lock files.
- There is a
.gradle
-directory in your home directory