Flutter升级后无法运行代码,Gradle依赖下载超时求助
问题:Flutter升级后无法运行代码,Gradle依赖连接超时失败
问题描述
我在完成Flutter升级操作后,完全无法运行任何代码——就连官方示例项目启动时都会抛出异常。我已经尝试搜索相关解决方案,但都没能解决问题。构建过程中出现的核心异常如下:
FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. > Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'. > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-9d5b21729ff53dbf8eadd8bc97e0e30d77abec95. Required by: project :app > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-9d5b21729ff53dbf8eadd8bc97e0e30d77abec95. > Could not get resource 'https://dl.google.com/dl/android/maven2/io/flutter/flutter_embedding_debug/1.0.0-9d5b21729ff53dbf8eadd8bc97e0e30d77abec95/flutter_embedding_debug-1.0.0-9d5b21729ff53dbf8eadd8bc97e0e30d77abec95.pom'. > Could not GET 'https://dl.google.com/dl/android/maven2/io/flutter/flutter_embedding_debug/1.0.0-9d5b21729ff53dbf8eadd8bc97e0e30d77abec95/flutter_embedding_debug-1.0.0-9d5b21729ff53dbf8eadd8bc97e0e30d77abec95.pom'. > Connect to mirror.vtwo.org:8850 [mirror.vtwo.org/5.152.221.178] failed: Connection timed out: connect
后续x86_debug、x86_64_debug等多个Flutter依赖包都出现了相同的连接mirror.vtwo.org:8850超时问题,最终导致Gradle的assembleDebug任务失败,退出码为1。
我的flutter doctor检测结果显示一切正常:
Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.18362.1016], locale en-US) [√] Android toolchain - develop for Android devices (Android SDK version 29.0.3) [√] Android Studio (version 3.5) [√] VS Code (version 1.47.2) [√] Connected device (1 available) • No issues found!
解决方案
更新: 我尝试升级了项目中的Gradle版本后,问题成功解决了。
内容的提问来源于stack exchange,提问作者Wehid Behrami
相关产品推荐
相关产品推荐

