3

Not sure if this question is for stackoverflow or superuser

EDIT: superuser doesn't even have a gradle tag, so I'm guessing this is for stackoverflow

Hi i am trying to run ./mach gradle app:test to test bug fixes in mozillas code

When I run it I get this error

Timeout waiting to lock artifact cache (/home/user/.gradle/caches/modules-2). It is currently in use by another Gradle instance.

I get the same error when running ./mach gradle app:checkstyle so I assume I would get this with and gradle command

I've checked to see what daemons where running with service --status-all but there i nothing there with the word gradle in it

The other questions I've looked at had answers that say to run gradle --stop to check if daemons are running. When I run that command it says Stopping daemon(s) and hangs

How can I fix this? I have tried closing and re-opening the terminal.

Matt
  • 2,232
  • 8
  • 35
  • 64
  • Possible duplicate : http://stackoverflow.com/questions/21523508/it-is-currently-in-use-by-another-gradle-instance – gaganbm Nov 27 '16 at 19:52

5 Answers5

11

Error message

* What went wrong:
> Could not resolve all dependencies for configuration ':runtime'.
   > Timeout waiting to lock artifact cache (\Users\username\.gradle\caches\modules-2). It is currently in use by another Gradle instance.
     Owner PID: 10736
     Our PID: 204
     Owner Operation: resolve configuration ':classpath'
     Our operation:
     Lock file: \Users\username\.gradle\caches\modules-2\modules-2.lock

* Try:
Run with --info or --debug option to get more log output.

it's occours when you terminate gradle build task by Ctrl+C or Crtl+Z .

rm your_path/modules-2.lock
Bill
  • 1,268
  • 14
  • 14
6
  1. Close Android Studio and open task manager and end the process java.exe or openJDK platform binary.exe.
  2. Open the directory gradle\caches\modules-2\modules-2.lock file delete
  3. Open Android Studio and check it.
H. Pauwelyn
  • 13,575
  • 26
  • 81
  • 144
0

Had the same issue, this problem occur when yarn or npm run android is terminated at the terminal by Ctrl + Z. What i did to solve it was to delete /modules-2.lock by running rm yourpath/modules-2.lock. Then after that, re-run yarn run android or react-native run-android``` and your build will be successfull

Sunday Aroh
  • 21
  • 1
  • 4
0

go to file menu

select invalidate cache and restart

on starting android again go to file select sync with file then once done sync with gradle

0
  1. Close Android Studio, IntelliJ, or the JetBrains IDEA which you are using.
  2. If you are using a Windows machine then End the process java.exe or binary.exe from the task manager. Else If you are using a Mac machine (UNIX) then clean the process from the activity monitor
  3. Then navigate to the 'gradle\caches\modules-2' (or the appearing path in the console) and then delete the .lock file
  4. Now try running the application.