[英]Caused by: java.io.IOException: Unable to lock usage tracking spool file
Having problems while building an android application with gradle, here is the error i get when building it; 在使用gradle构建android应用程序时遇到问题,这是构建它时出现的错误;
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 这是我的gradle详细信息: 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
Killing the java process and re-building fixes it but you have to do this on every build. 杀死java进程并重新构建修复它但你必须在每个构建上执行此操作。
os x el capitan 10.11 (15A284) os x el capitan 10.11(15A284)
https://github.com/gradle/gradle/issues/937 https://github.com/gradle/gradle/issues/937
https://docs.gradle.org/current/userguide/gradle_daemon.html https://docs.gradle.org/current/userguide/gradle_daemon.html
I found these two other Stackoverflow threads that were helpful: 我发现这两个有用的Stackoverflow线程:
The issue in this case was that the Gradle Daemon was holding onto a file lock and subsequent builds were failing. 在这种情况下的问题是Gradle守护进程持有文件锁并且后续构建失败。 This Gradle issue provided a more sustainable workaround:
Gradle问题提供了更可持续的解决方法:
Gradle daemon locks files by leaving file handles open Gradle守护程序通过保持文件句柄打开来锁定文件
Disable the daemon by adding
org.gradle.daemon=false
togradle.properties
通过将
org.gradle.daemon=false
添加到gradle.properties
来禁用该守护程序
There are quite a few other variations on how to disable the Gradle build in the documentation 关于如何在文档中禁用Gradle构建还有很多其他变体
The Gradle Daemon is useful for making builds faster by avoiding restarting the JVM and reloading the Gradle jar, and also by caching information. Gradle守护程序可以通过避免重新启动JVM并重新加载Gradle jar以及缓存信息来更快地进行构建。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.