Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 768
user3499878 Avatar asked Aug 03 '15 09:08

user3499878


4 Answers

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.

like image 119
mcarlin Avatar answered Oct 09 '22 08:10

mcarlin


File > Invalidate cache / restart

works for me!!!

enter image description here

like image 44
Lokesh Avatar answered Oct 09 '22 10:10

Lokesh


I have got the same issue:

enter image description here

To resolve this issue, kill the process which retain the journal with kill -9 command

Log explain perfectly which process is involved in your issue, so you can retrieve the PID or the file path concerned

In this example, the command will be:

kill -9 9739

like image 10
Kevin ABRIOUX Avatar answered Oct 09 '22 09:10

Kevin ABRIOUX


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

like image 8
Roman K Avatar answered Oct 09 '22 09:10

Roman K