Flutter error on building files in Android Studio

孤者浪人 提交于 2021-02-18 17:54:05

问题


I have newly installed Flutter on Android Studio. I had a source code of flutter which I want to open using it. I installed the latest flutter plugin and flutter SDK. But when I try to run the app, it shows me the following error:

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

I am completely new to this and have no idea where this error is pointing. I have the latest Flutter SDK version: Flutter 1.17.0 and Dart 2.8.1, it's a stable version. My Android Studio version is 3.6.2


回答1:


Try executing this in your terminal :

flutter pub cache repair

If it doesn't work, deleting the flutter folder, along with the cache folder should do the job.




回答2:


In my case i solved this problem adding the latest version of flutter svg to pubspec.yaml

Check the link to install latest version: https://pub.dev/packages/flutter_svg#-installing-tab-



来源:https://stackoverflow.com/questions/61663167/flutter-error-on-building-files-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!