簡體   English   中英

Flutter 在 Android Studio 中構建文件時出錯

[英]Flutter error on building files in Android Studio

我在 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

我對此完全陌生,不知道這個錯誤指向哪里。 我有最新的ZC047B10EEEE763AFB6164E07CF1CC268Z ZF20E3C5E3C5E54C0AB3D375D660B396F896F896F6F6F6AZ版本:ZC047B10EEEEEEEEEEEEE763AFB61616164EES1CCF1CCC268S.187.177.17.17.17.17.17.17.17.17.17.17.17.17.17.17.17.lz 17.17.17.17.17.17.17.17.17.17.17.17.17.lz。 我的 Android Studio 版本是 3.6.2

嘗試在您的終端中執行此操作:

flutter pub cache repair

如果它不起作用,刪除 flutter 文件夾以及緩存文件夾應該可以完成這項工作。

在我的情況下,我解決了這個問題,將最新版本的 flutter svg 添加到 pubspec.yaml

檢查鏈接以安裝最新版本: https://pub.dev/packages/flutter_svg#-installing-tab-

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM