Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

It is currently in use by another Gradle instance

Remove the lock files in the gradle cache by executing something like this:

find ~/.gradle -type f -name "*.lock" -delete

Sometimes fast way comes in a non-elegant deal, there we go:

Find first the # of all gradle process running on

ps -A | grep gradle

After that, get the IDs, Kill 'em all one by one

sudo kill -9 <process ID>

Now you're good ;-)


I was stuck with this error and had to blow away the contents of my user's .gradle/caches/ folder and the contents of my project's .gradle/ folder to get going again.

Not sure what caused it, possibly a failed build that kept these files in a locked state?


For Windows machine:

Open Task Manager(Ctrl-Alt-Delete and check Process)

-> If you run two instance of android studio, Close One (End Task)

-> Then close OpenJDK Platform Binary

-> Gradle sync now on AndroidStudio and it will work now


gradlew --stop

I had a similar error, running the above command worked for me.


This may be happening because there is more than just once instance of Android Studio.


Just kill java.exe process fix my problem.

-- Edit --

if not fixed then:

  • kill OpenJdkPlatform proccess.

if not fixed then:

  • remove all ".lock" file from .gradle directory and sub directories (windows: C:\Users\Username\.gradle).

if not fixed then:

  • rename or delete .gradle directory and try again.