Error:Timeout waiting to lock buildscript class cache for build file when change minSdkVersion
I try to change minSdkVersion
in build.gradle
(Module: app) in Android Studio
and get next error:
Error:Timeout waiting to lock buildscript class cache for build file 'E:\pathtoproject\app\build.gradle' (C:\Users\Administrator\.gradle\caches\2.2.1\scripts\build_f00bwdji3qxl7urq5chsbakgv\ProjectScript\buildscript). It is currently in use by another Gradle instance.
Owner PID: unknown
Our PID: 4592
Owner Operation: unknown
Our operation: Initialize cache
Lock file: C:\Users\Administrator\.gradle\caches\2.2.1\scripts\build_f00bwdji3qxl7urq5chsbakgv\ProjectScript\buildscript\cache.properties.lock
What is it error? How to change minSdkVersion
?
This sounds like it's related to https://issues.gradle.org/browse/GRADLE-2795.
The easiest way to solve this will be to delete everything under C:\Users\Administrator\.gradle\caches
. There is a cache.properties.lock
that is holding a global lock which is preventing you from running your script.
For Mac OSX the folder is located in ~/.gradle/caches
. The Android Studio should show the proper path to the file which is causing the lock anyway.
File > Invalidate cache / restart
works for me!!!
The lock file is there because some other gradle process (usually the daemon) is using the cache. You could stop all gradle processes to release the lock
gradle --stop
https://docs.gradle.org/current/userguide/gradle_daemon.html#sec:stopping_an_existing_daemon
for me, it solved the problem by killing the PID
- Windows taskkill /F /PID pid_number
- Linux kill -9 pid_number