我在Android Studio上新安装了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
发布于 2020-05-08 01:29:38
尝试在您的终端中执行以下命令:
flutter pub cache repair
如果不起作用,删除flutter文件夹和缓存文件夹就可以了。
发布于 2020-05-26 02:43:39
在我的例子中,我解决了这个问题,将最新版本的flutter svg添加到pubspec.yaml中
检查链接以安装最新版本:https://pub.dev/packages/flutter_svg#-installing-tab-
https://stackoverflow.com/questions/61663167
复制相似问题