在 vs code 上启动 flutter 应用程序时出现以下错误。
Launching lib\main.dart on RMX1801 in debug mode... Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: C:\Users\sanjay.gradle\wrapper\dists\gradle-5.6.2-all\9st6wgf78h16so49nn74lgtbb\gradle-5.6.2-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 trying to update itself. Retrying the update... Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: C:\Users\sanjay.gradle\wrapper\dists\gradle-5.6.2-all\9st6wgf78h16so49nn74lgtbb\gradle-5.6.2-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 trying to update itself. Retrying the update... Gradle task assembleDebug failed with exit code 1 Exited (sigterm)
我不明白为什么会这样。这可能是什么原因,如何解决?
最佳答案
这是由使用的 Gradle 分发版本引起的。要解决此问题,请将您的 Gradle 版本降级到以前的版本或将其升级到下一个稳定版本。这些是 Gradle distribution可用版本。
转到
android / gradle / wrapper / gradle-wrapper.properties
并替换当前的 Gradle 版本(或从 Gradle distribution 中选择另一个)
distributionUrl=https://services.gradle.org/distributions/gradle-6.0.1-all.zip
我将我的 Gradle 版本从 5.6.2 升级到 6.0.1,它对我来说工作正常。
关于java - Gradle 任务 assembleDebug 失败,退出代码为 1(运行时异常),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59316518/