Jatin Pandey
Jatin Pandey

Reputation: 705

Could not create service of type FileAccessTimeJournal using GradleUserHomeScopeServices.createFileAccessTimeJournal() error in gradle

I am facing this issue while building flutter apps in VS Code and I could not find any simple solution for this issue. Please help me resolve this issue.

FAILURE: Build failed with an exception.

What went wrong:

Could not create service of type FileAccessTimeJournal using GradleUserHomeScopeServices.createFileAccessTimeJournal(). Timeout waiting to lock journal cache (/home/jatin/.gradle/caches/journal-1). It is currently in use by another Gradle instance. Owner PID: 3813 Our PID: 5034 Owner Operation: Our operation: Lock file: /home/jatin/.gradle/caches/journal-1/journal-1.lock Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 1m 2s
Running Gradle task ‘assembleDebug’…
Running Gradle task ‘assembleDebug’… Done 63.5s
Gradle task assembleDebug failed with exit code 1

A detailed solution would be appreciated. Also, I am unaware of the stacktrace option .(* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.)

Upvotes: 20

Views: 21628

Answers (9)

Muhammad Sulaiman
Muhammad Sulaiman

Reputation: 151

I had the same issue, i run the following command and it worked for me,

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

Upvotes: 2

gavenkoa
gavenkoa

Reputation: 48893

My problem was because I tried to start gradlew by WSL bash instead of by Cygwin's which resulted in an error:

> Could not create service of type FileAccessTimeJournal using GradleUserHomeScopeServices.createFileAccessTimeJournal().
   > java.io.IOException: Invalid argument

I have noticed a message:

The daemon log file: /mnt/c/srv/gradle/daemon/6.6.1/daemon-29382.out.log

For Cygwin that path should have been started with /cygdrive/c.

Upvotes: 0

Magada
Magada

Reputation: 21

I had the same problem.

Gradle sync failed: Timeout waiting to lock daemon addresses registry [...]. It is currently in use by another Gradle instance.

Owner PID: 4567 Our PID: 5678 Owner Operation: ...

My solution was to delete .gradle caches folder (In Mac you can use Command + Shift + . to get .gradle folder)

/user/..../.gradle/caches

Everything works fine.

Upvotes: 2

ArpitA
ArpitA

Reputation: 741

I tried the above solution but nothing worked . Restarting my macbook solved the issue .

So , in case above solutions are not working try the old way i.e. restarting !!

Upvotes: 0

Roman Stakhovskiy
Roman Stakhovskiy

Reputation: 41

My solution was to downgrade the gradle version from 6.8.2 to 6.7.2

Upvotes: 1

Duy Dau Dzu
Duy Dau Dzu

Reputation: 210

That Gradle failure message would be:

Gradle sync failed: Timeout waiting to lock daemon addresses registry [...].
It is currently in use by another Gradle instance.

Owner PID: 4567
Our PID: 5678
Owner Operation: ...

If you're using macOS or linux for development, just kill the owner process:

sudo kill -9 4567

Upvotes: 21

Divya
Divya

Reputation: 171

I had the same problem but thankfully I found a way to do it without restarting the container. Ran the following command to stop daemons on Gradle. This made the other daemon stop and blocking my Gradle runs

./gradlew --stop 

OR

gradle --stop

Upvotes: 17

Carles Roch-Cunill
Carles Roch-Cunill

Reputation: 29

I had the same problem when interrupting a batch file that was calling individual groovy scripts like

os.system('./gradlew chromeTest --tests=\"MyTestScript_1\")

The batch file contains several calls like the one above, and I interrupted it due to errors in my scripts. Once the errors were corrected, I tried again to run the batch file but then I got the error reported in this ticket.

To solve it I tried to stop gradle with

./gradlew --stop

or

gradle --stop

and then restarting gradle with

./gradlew --daemon

But when executing again my batch file I still got the same error message. The only way I was able to make it work again was rebooting my container. Heavy handed but it worked. I would like to know a better way!.

Upvotes: 3

Arina Naumova
Arina Naumova

Reputation: 246

Had the same problem, these actions worked for me: Close IDE. Go to windows task manager -> processes. Find java.exe processes there and end them.

Hope this helps :)

Upvotes: 23

Related Questions