本文介绍了Android Studio:无法启动守护进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在 Android Studio 中导入 gradle 项目时遇到以下错误.

I'm facing the below error when I'm trying to import a gradle project in Android Studio.

Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/1.8/userguide/gradle_daemon.html
Please read below process output to find out more:

这是我看到的输出:

18:25:42.484 [main] DEBUG o.g.l.daemon.bootstrap.DaemonMain - Assuming the daemon was started with following jvm opts: [-XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=windows-1252]
18:25:43.254 [main] DEBUG o.g.l.daemon.server.DaemonServices - Creating daemon context with opts: [-XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=windows-1252]
18:25:43.306 [DEBUG] [org.gradle.logging.internal.DefaultLoggingConfigurer] Finished configuring with level: DEBUG, configurers: [org.gradle.logging.internal.OutputEventRenderer@47078ad, org.gradle.logging.internal.logback.LogbackLoggingConfigurer@7402a821, org.gradle.logging.internal.JavaUtilLoggingConfigurer@5a6c4a07]
18:25:43.356 [INFO] [org.gradle.launcher.daemon.server.Daemon] start() called on daemon - DefaultDaemonContext[uid=e58252c1-7a49-4be4-a6cd-1bd3d6d0880d,javaHome=C:\Program Files\Java\jdk1.7.0_45,daemonRegistryDir=C:\Users\Sowmya\.gradle\daemon,pid=15432,idleTimeout=60000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252]
18:25:43.362 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] updating lastActivityAt to 1386593743362
18:25:43.702 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface lo
18:25:43.705 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? true
18:25:43.706 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback address /127.0.0.1
18:25:43.707 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback address /0:0:0:0:0:0:0:1
18:25:43.708 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface net0
18:25:43.711 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
DefaultDaemonContext[uid=e58252c1-7a49-4be4-a6cd-1bd3d6d0880d,javaHome=C:\Program Files\Java\jdk1.7.0_45,daemonRegistryDir=C:\Users\Sowmya\.gradle\daemon,pid=15432,idleTimeout=60000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252]
18:25:43.951 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
18:25:43.954 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
18:25:43.957 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
18:25:43.962 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
18:25:43.963 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
18:25:43.966 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
18:25:43.976 [ERROR] [system.err]
18:25:43.977 [ERROR] [system.err] FAILURE: Build failed with an exception.
18:25:43.977 [ERROR] [system.err]
18:25:43.978 [ERROR] [system.err] * What went wrong:
18:25:43.979 [ERROR] [system.err] Could not write cache value to 'C:\Users\Sowmya\.gradle\daemon\1.8\registry.bin'.
18:25:43.979 [ERROR] [system.err]
18:25:43.980 [ERROR] [system.err] * Try:
18:25:43.981 [ERROR] [system.err] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
18:25:44.009 [INFO] [org.gradle.launcher.daemon.bootstrap.DaemonMain] Daemon[pid = 15432] process has finished.
18:25:44.010 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Removing daemon address: [9ae053cd-4dc2-4cb8-8f60-bb3c5983eb67 port:55117, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]]
18:25:44.011 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
18:25:44.012 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
18:25:44.013 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
18:25:44.014 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
18:25:44.015 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
18:25:44.016 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
18:25:44.021 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] VM shutdown hook was unable to remove the daemon address from the registry. It will be cleaned up later.
org.gradle.api.GradleException: Could not write cache value to 'C:\Users\Sowmya\.gradle\daemon\1.8\registry.bin'.
    at org.gradle.cache.internal.SimpleStateCache.serialize(SimpleStateCache.java:74)
    at org.gradle.cache.internal.SimpleStateCache.access$100(SimpleStateCache.java:28)
    at org.gradle.cache.internal.SimpleStateCache$2.run(SimpleStateCache.java:50)
    at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.doWriteAction(DefaultFileLockManager.java:198)
    at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.writeFile(DefaultFileLockManager.java:187)
    at org.gradle.cache.internal.OnDemandFileAccess.writeFile(OnDemandFileAccess.java:58)
    at org.gradle.cache.internal.SimpleStateCache.set(SimpleStateCache.java:48)
    at org.gradle.cache.internal.FileIntegrityViolationSuppressingPersistentStateCacheDecorator.set(FileIntegrityViolationSuppressingPersistentStateCacheDecorator.java:38)
    at org.gradle.cache.internal.FileIntegrityViolationSuppressingPersistentStateCacheDecorator.update(FileIntegrityViolationSuppressingPersistentStateCacheDecorator.java:46)
    at org.gradle.launcher.daemon.registry.PersistentDaemonRegistry.remove(PersistentDaemonRegistry.java:109)
    at org.gradle.launcher.daemon.server.Daemon$1.run(Daemon.java:100)
Caused by: java.io.FileNotFoundException: C:\Users\Sowmya\.gradle\daemon\1.8\registry.bin (Access is denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    at org.gradle.cache.internal.SimpleStateCache.serialize(SimpleStateCache.java:67)
    ... 10 more`

我已经关闭了在 SO 中的解决方案中提到的我的防病毒软件.但似乎没有任何效果.

I've turned off my anti-virus which was mentioned in a solution in SO. But nothing seems to work.

推荐答案

尝试从 C:\Users\ 目录中删除您的 .gradle 并重试.

Try deleting your .gradle from C:\Users\<username> directory and try again.

这篇关于Android Studio:无法启动守护进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 13:18