我尝试在新创建的flutter项目上运行'flutter run',但是它卡在了解决依赖关系中,并在日志中出现了以下错误。
Launching lib/main.dart on ASUS X00DDA in debug mode...
Initializing gradle... 1.2s
Resolving dependencies...
* Error running Gradle:
Exit code 1 from: C:\Users\username\Desktop\Project\myprojectr\android\gradlew.bat app:properties:
Starting a Gradle Daemon, 14 stopped Daemons could not be reused, use --status for details
FAILURE: Build failed with an exception.
* What went wrong:
Could not connect to the Gradle daemon.
Daemon uid: 6a5529f2-392b-4727-b66f-78a2fab605bf with diagnostics:
Daemon pid: 14840
log file: C:\Users\arjay24\.gradle\daemon\4.1\daemon-14840.out.log
----- Last 20 lines from daemon log file - daemon-14840.out.log -----
15:00:39.882 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] DaemonExpirationPeriodicCheck running
15:00:39.888 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
15:00:39.889 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
15:00:39.890 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
15:00:39.891 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
15:00:39.891 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
15:00:39.892 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
15:00:39.893 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
15:00:39.893 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
15:00:39.893 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
15:00:49.885 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] DaemonExpirationPeriodicCheck running
15:00:49.885 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
15:00:49.886 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
15:00:49.886 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
15:00:49.887 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
15:00:49.887 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
15:00:49.888 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
15:00:49.889 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
15:00:49.889 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] The file lock is held by a different Gradle process (pid: 13900, operation: ). Will attempt to ping owner at port 61789
15:00:49.889 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] The file lock is held by a different Gradle process. I was unable to read on which port the owner listens for lock access requests.
----- End of the daemon log -----
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
Please review your Gradle project setup in the android/ folder.
这很奇怪,因为前几天它可以正常运行,而且我没有更改或安装任何东西。
答案 0 :(得分:0)
该问题似乎不是由 Flutter 引起的。检查日志,由于“文件锁由不同的 Gradle 进程持有”,实例无法连接到 Gradle 守护程序。如果您仍然遇到此问题,可以尝试 removing the lock files in the Gradle cache 并再次尝试运行该应用吗?