Flutter 抛出错误,“异常:Gradle 任务 assembleDebug 失败,退出代码为 1”

时间:2021-04-13 09:35:45

标签: flutter dart gradle build.gradle gradle-plugin

Launching lib\main.dart on SM G615F in debug mode...
lib\main.dart:1
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: C:\Users\Me\.gradle\wrapper\dists\gradle-6.7-all\cuy9mc7upwgwgeb72wkcrupxe\gradle-6.7-all.zip
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:61)
    at org.gradle.wrapper.Install.createDist(Install.java:48)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: C:\Users\Shaad\.gradle\wrapper\dists\gradle-6.7-all\cuy9mc7upwgwgeb72wkcrupxe\gradle-6.7-all.zip
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:61)
    at org.gradle.wrapper.Install.createDist(Install.java:48)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

你能帮我解决这个问题吗? 我收到 Gradle 任务 assembleDebug 错误,当我在物理设备上运行 Flutter 时,它需要很多时间来运行和执行。

我想在这方面寻求帮助。

1 个答案:

答案 0 :(得分:0)

这可能是由于 gradle 安装损坏造成的

删除 .gradle 文件夹 (C:\Users\Me.gradle)

然后再次运行 flutter 应用程序。

可能需要更长的时间,因为它正在下载文件,但不要断开您的设备。