FAILURE:构建失败并出现异常 (Flutter)

Posted

技术标签:

【中文标题】FAILURE:构建失败并出现异常 (Flutter)【英文标题】:FAILURE: Build failed with an exception (Flutter) 【发布时间】:2020-06-13 05:57:55 【问题描述】:

我在重新安装我的 dart SDK 后尝试运行我的 Flutter 应用程序,尽管已连接到互联网,但它仍然出现此错误。我已经有这个问题很长时间了。我试过删除 应用插件:'com.google.gms.google-services' 但它似乎没有效果。我很茫然。 我已经尝试过flutter clean,将频道从beta更改为stable,然后再改回beta和stable,重新安装api级别为28的sdk。所有这一切都是在我使用Animator小部件时遇到的一些问题之后开始的,一些关于blocs的问题。


* 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-c4229bfbbae455ad69c967be19aee3fadd6486e1.
     Required by:
         project :app
         project :app > project :google_sign_in
         project :app > project :firebase_storage
         project :app > project :google_api_availability
         project :app > project :sqflite
         project :app > project :geolocator
         project :app > project :firebase_messaging
         project :app > project :path_provider
         project :app > project :cloud_firestore
         project :app > project :location_permissions
         project :app > project :image_picker
         project :app > project :firebase_auth
         project :app > project :firebase_core
      > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'https:/maven.google.com/io/flutter/flutter_embedding_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/flutter_embedding_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'https:/maven.google.com/io/flutter/flutter_embedding_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/flutter_embedding_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > URI does not specify a valid host name: https:/maven.google.com/io/flutter/flutter_embedding_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/flutter_embedding_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom
      > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/flutter_embedding_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/flutter_embedding_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > Connection reset
      > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/flutter_embedding_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/flutter_embedding_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > Connection reset
      > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/flutter_embedding_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/flutter_embedding_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > Connection reset
   > Could not resolve io.flutter:arm64_v8a_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
     Required by:
         project :app
      > Could not resolve io.flutter:arm64_v8a_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'https:/maven.google.com/io/flutter/arm64_v8a_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/arm64_v8a_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'https:/maven.google.com/io/flutter/arm64_v8a_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/arm64_v8a_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > URI does not specify a valid host name: https:/maven.google.com/io/flutter/arm64_v8a_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/arm64_v8a_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom
      > Could not resolve io.flutter:arm64_v8a_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'http://download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/arm64_v8a_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/arm64_v8a_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > Connection reset
      > Could not resolve io.flutter:arm64_v8a_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'http://download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/arm64_v8a_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/arm64_v8a_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > Connection reset
      > Could not resolve io.flutter:arm64_v8a_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'http://download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/arm64_v8a_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/arm64_v8a_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > Connection reset
   > Could not resolve io.flutter:x86_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
     Required by:
         project :app
      > Could not resolve io.flutter:x86_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'https:/maven.google.com/io/flutter/x86_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'https:/maven.google.com/io/flutter/x86_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > URI does not specify a valid host name: https:/maven.google.com/io/flutter/x86_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom
      > Could not resolve io.flutter:x86_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > Connection reset
      > Could not resolve io.flutter:x86_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > Connection reset
      > Could not resolve io.flutter:x86_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > Connection reset
   > Could not resolve io.flutter:x86_64_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
     Required by:
         project :app
      > Could not resolve io.flutter:x86_64_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'https:/maven.google.com/io/flutter/x86_64_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_64_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'https:/maven.google.com/io/flutter/x86_64_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_64_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > URI does not specify a valid host name: https:/maven.google.com/io/flutter/x86_64_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_64_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom
      > Could not resolve io.flutter:x86_64_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_64_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_64_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > Connection reset
      > Could not resolve io.flutter:x86_64_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_64_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_64_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > Connection reset
      > Could not resolve io.flutter:x86_64_debug:1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_64_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1/x86_64_debug-1.0.0-c4229bfbbae455ad69c967be19aee3fadd6486e1.pom'.
               > Connection reset

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 56s
Finished with error: Gradle task assembleDebug failed with exit code 1

【问题讨论】:

【参考方案1】:

我怀疑使用的是原版 Dart SDK,而不是 Flutter 附带的 SDK。

一个简单的解决方法是删除您安装的 Dart SDK 并重新安装 Flutter。

或者,修复 PATH 环境变量可以确保使用的 SDK。

【讨论】:

很好,考虑接受这个答案,因为它也会帮助其他人。

以上是关于FAILURE:构建失败并出现异常 (Flutter)的主要内容,如果未能解决你的问题,请参考以下文章

FAILURE:Gradle 构建失败并出现异常

FAILURE:构建失败并出现异常 (Flutter)

FAILURE:构建失败并出现异常。无法解析所有文件以进行配置

错误:找不到类型“表元数据”| FAILURE:构建失败并出现异常

FAILURE:通过“flutter build appbundle”命令构建项目时构建失败并出现异常

FAILURE:构建失败,出现异常 flutter error 。帮我