3

Having problems while building an android application with gradle, here is the error i get when building it;

Caused by: java.io.IOException: Unable to lock usage tracking spool file
            at com.android.tools.analytics.JournalingUsageTracker.newTrackFile(JournalingUsageTracker.java:98)
            at com.android.tools.analytics.JournalingUsageTracker.<init>(JournalingUsageTracker.java:78)
            ... 121 more
    Caused by: java.nio.channels.OverlappingFileLockException
            at com.android.tools.analytics.JournalingUsageTracker.newTrackFile(JournalingUsageTracker.java:95)
            ... 122 more

Here is my gradle details: https://pastebin.com/6v0dk5in

 ./gradlew --version

------------------------------------------------------------
Gradle 4.3.1
------------------------------------------------------------

Build time:   2017-11-08 08:59:45 UTC
Revision:     e4f4804807ef7c2829da51877861ff06e07e006d

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_66 (Oracle Corporation 25.66-b17)
OS:           Mac OS X 10.11 x86_64

2 Answers2

1

Killing the java process and re-building fixes it but you have to do this on every build.

os x el capitan 10.11 (15A284)

https://github.com/gradle/gradle/issues/937

https://docs.gradle.org/current/userguide/gradle_daemon.html

0

I found these two other Stackoverflow threads that were helpful:

The issue in this case was that the Gradle Daemon was holding onto a file lock and subsequent builds were failing. This Gradle issue provided a more sustainable workaround:

Gradle daemon locks files by leaving file handles open

Disable the daemon by adding org.gradle.daemon=false to gradle.properties

There are quite a few other variations on how to disable the Gradle build in the documentation

The Gradle Daemon is useful for making builds faster by avoiding restarting the JVM and reloading the Gradle jar, and also by caching information.

Dagmar
  • 2,968
  • 23
  • 27