In Flutter app development, you may encounter the error “It is currently in use by another Gradle instance flutter”. This error is fairly common and is one you’re likely to encounter. It’s useful to know the solution, so let’s remember it.
The full error message looks like this:
Gradle sync failed: Timeout waiting to lock daemon addresses registry [...].
It is currently in use by another Gradle instance.
Owner PID: 1234
Our PID: 5678
Owner Operation: ...
As the error above indicates, this error includes a string like “Owner PID: 1234”. This owner process is causing the problem, so you can resolve this error by forcibly terminating it.
To terminate a process by PID from PowerShell, execute a command like this:
Stop-Process -Id 1234
Note that there are also solution answers that say you should delete the .lock file with a command like find ~/.gradle -type f -name “*.lock” -delete, but in my environment, this didn’t solve the problem.
(Reference)
It is currently in use by another Gradle instance - Stack Overflow