It is currently in use by another Gradle instance

2019-01-21 15:51发布

I'm new to Gradle build system. I want to do some basic functions on it. I'm running/building it in command line. I am referring User guide. And, doing some simple tasks.

When I start to run simple tasks, it was build successfully. But, After some times, it is showing "It is currently in use by another Gradle instance" and becomes BUILD FAILED. I'm using a terminal for run the task. I didn't run anything at that time.

If I closed the terminal which generate the error, this problem would be solved. But, I know that it is not the solution for that.

Why is this error coming frequently?

How to solve it?

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

16条回答
贼婆χ
2楼-- · 2019-01-21 16:28

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.

查看更多
小情绪 Triste *
3楼-- · 2019-01-21 16:29

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

查看更多
Evening l夕情丶
4楼-- · 2019-01-21 16:29

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
查看更多
劫难
5楼-- · 2019-01-21 16:32

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)

查看更多
Ridiculous、
6楼-- · 2019-01-21 16:35

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

    find ~/.gradle -type f -name "*.lock" | while read f; do rm $f; done
查看更多
Juvenile、少年°
7楼-- · 2019-01-21 16:35

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.
查看更多
登录 后发表回答