在Android Studio中构建文件时出现Flutter错误

问题描述 投票:0回答:1

我在Android Studio上新安装了Flutter。我有一个flutter的源代码,我想用它打开。我安装了最新的flutter插件和flutter SDK。但当我尝试运行应用程序时,它显示了以下错误。

Compiler message:
/C:/Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.14.4/lib/src/picture_stream.dart:92:3: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
  PictureStream();
  ^^^^^^^^^^^^^
/C:/Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.14.4/lib/src/picture_stream.dart:192:16: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
abstract class PictureStreamCompleter extends Diagnosticable {
               ^

Compiler message:
/C:/Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.14.4/lib/src/picture_stream.dart:92:3: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
  PictureStream();
  ^^^^^^^^^^^^^
/C:/Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.14.4/lib/src/picture_stream.dart:192:16: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
abstract class PictureStreamCompleter extends Diagnosticable {
               ^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Flutter SDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Flutter SDK\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* 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 23s
Exception: Gradle task assembleDebug failed with exit code 1

我完全是个新手,不知道这个错误指向哪里。我有最新的Flutter SDK版本。Flutter 1.17.0和Dart 2.8.1,这是一个稳定的版本。我的Android Studio版本是3.6.2。

android android-studio flutter dart flutter-layout
1个回答
2
投票

试着在你的终端中执行这个。

flutter pub cache repair

如果它不工作,删除flutter文件夹,以及缓存文件夹应该做的工作。


0
投票

在我的例子中,我解决了这个问题,在pubspec.yaml中添加最新版本的flutter svg。

查看链接,安装最新版本。https:/pub.devpackagesflutter_svg#-installing-tab-。

© www.soinside.com 2019 - 2024. All rights reserved.