It is currently in use by another Gradle instance

大城市里の小女人 提交于 2019-11-28 16:29:07
The night manager

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

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

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?

Justin

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

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

For Windows OS:

I figured it had something to do with a lock file so i simply went to .gradle\buildOutputCleanup in the project folder and deleted the cache.properties.lock file and rebuilt the project. It was working perfectly.

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 ;-)

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.

press CTRL + SHIFT + ESC to open task manager now find OpenJDK and kill it goto where the error is pointing to like

D:\.gradle\daemon\4.10.1\registry.bin.lock

delete the file and resynce and you're good to go.

It was not necessary for me to remove any files to fix this error.

The issue I had is that Gradle instances had hung and were 6 command prompt entries in my task list that were spawned by Java.

Forcing the command prompt instances to close allowed me to continue work as usual.

user3552453

Its Work for me for Problem:-

"Error:Timeout waiting to lock jars It is currently in use by another Gradle instance. Owner PID: 6896 Our PID: 5048 Owner Operation: Our operation: Lock"

Solution:-

  1. close the Android Studio and Open Task manager and end the process java.exe
  2. open the derectory ....gradle\caches.
  3. Delete the jar2.lock file.
  4. Open android Studion and clean the project.

Have tried all this answers, including kill java process, delete .gradle in HOME_DIR and in project dir, restarted Android Studio, and even restarted OS.

It started to work normally only after I launched gradle sync.

Very simple solution:

no need to kill Android Studio , just Kill OpenJdkPlatform process, then delete the .lock file located in:

rootProject/.gradle/<version>/taskHistory

While killing the process and/or removing the lock file works, Gradle should be able to handle this on its own, solving the problem permanently. This problem report hints at the solution: Gradle cannot communicate with the gradle service.

Have a look at your local network firewall. In my case,

  • allowing outbound traffic from 127.0.0.1 to 127.0.0.1,

    sudo iptables -A OUTPUT -p udp -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
    
  • allowing incoming traffic from 127.0.0.1

    sudo iptables -A INPUT -s 127.0.0.1 -p udp -j ACCEPT
    

solved the issue. A discussion of a similar problem at github.

And, Please refer any link to improve my knowledge on Gradle Build system in Android.

The udacity gradle course, if you have some time.

open terminal and move to project path then run depending on the operation system: gradlew clean or ./gradlew clean

I was facing the same problem. But I solved it by just restarting my android studio. I am using OneDrive to save my project.

I had same problem and i did two steps and it became solved.

  1. My JDK was not installed on Mac (i forgot to install) i installed it.
  2. I deleted all items from caches folder located in this path /Users/icon_developer/.gradle/ and rebuilt the project. It worked!

I had the same issue on mac:

take care, that your project is NOT on an external hard disk. The location of your project must be on the hard disk with your operating system.

(Building an Ionic app)

Having the same issue on a Mac, none of the above worked for me. What worked , though, was opening the Activity Monitor and closing a running java process. I also noticed that an .hprof file was generated, which I deleted. After that, I ran my project and it worked.

everyone finally, I have complete solution

Error :- Timeout Gradle cashe its running in other gradle


distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Please add this Line in Wrapper.Propertis and Sync now
After Sync the project When 
Invalidthcast\restart   to get the requesting componants
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!