6

I'm using Android Studio 2020.3.1 Patch 4(at 01-19-2022), Gradle 7.0.2. Java 11 Kotlin 1.6.10, mac Pro 16 m1 arm64(2021)

I'm new in macOS, jumped from Ubuntu, and found issues. I'm working with different projects and all time when I'm trying to switch to another one, I have the next error:

Gradle could not start your build.
Could not create service of type ResourceSnapshotterCacheService using 
GradleUserHomeServices.createResourceSnapshotterCacheService(). Timeout waiting to lock file hash cache

It sometimes happens when I'm trying to run or sync the same project.

Solution as find ~/.gradle -type f -name "*.lock" -delete not useful because I run it all time when I complete changes on sdk project and test it on another one. Relevant solutions like kill not useful too

I hope, somebody has a solution for that. Thank you :)

Error text:

Gradle could not start your build.

Could not create service of type ResourceSnapshotterCacheService using GradleUserHomeServices.createResourceSnapshotterCacheService(). Timeout waiting to lock file hash cache (/Users/{user}/.gradle/caches/7.0.2/fileHashes). It is currently in use by another Gradle instance. Owner PID: 73387 Our PID: 73419 Owner Operation: Our operation: Lock file: /Users/{user}/.gradle/caches/7.0.2/fileHashes/fileHashes.lock

Mangaldeep Pannu
  • 3,738
  • 2
  • 26
  • 45
  • Maybe you could use `ps aux | grep PID` (in your case `PID=73387`) to find out which process is also using Gradle. – chehsunliu Jan 23 '22 at 14:48
  • Thank you for your reply. I found that process is the previous Gradle project. So if you want to open 2 android studios (mean 2 Gradle projects) you will have that error. I found a temporary workaround that is just working only in one Gradle project. – Vitalii Suslin Jan 24 '22 at 15:45
  • 1
    That issue is reproduced not only on M1 but on Intel Macs as well. And yes, you can kill gradle process and run another one but sometimes you really need to run multiple gradle tasks but lock on shared files prevents them from executing. Searching for a solution as well. – Oleksiy Feb 03 '22 at 18:20
  • following as i am having the same issue on m1. I have tried so many methods listed in this post https://stackoverflow.com/questions/21523508/it-is-currently-in-use-by-another-gradle-instance but to no avail. For me, it happens when intellij is indexing and doing some gradle stuff when it opens the project. Then that process never seems to release some lock files. – Pupusa Jan 18 '23 at 19:20

0 Answers0