flutter 当我尝试构建APK时,调试控制台中显示以下内容,生成失败,出现异常

bksxznpy  于 2023-02-05  发布在  Flutter
关注(0)|答案(7)|浏览(105)

当我尝试构建APK时,调试控制台中显示以下内容。生成失败,出现异常。
控制台中的错误:
/C:/src/flutter/flutter/. pub-cache/hosted/www.example.com错误:找不到类型"可诊断混合"。类DatePickerTheme具有可诊断混合{^^^^^^^^^^^^^^^^^^^^^^^/C:/src/flutter/flutter/. pub-cache/hosted/www.example.com错误:找不到类型"可诊断混合"。类图片流具有可诊断混合{^^^^^^^^^^^^^^^/C:/src/flutter/flutter/. pub-cache/hosted/www.pub.dartlang.org/flutter_datetime_picker-1.3.8/lib/src/datetime_picker_theme.dart:6:28:无法将类型'DiagnosticableMixin'与具有DiagnosticableMixin的. class图片流混合{^/C:/src/flutter/flutter/. pub-cache/hosted/www.example.com错误:无法将类型'DiagnosticableMixin'与具有DiagnosticableMixin的. abstract class图片流完成器混合{^/C:/src/flutter/flutter/. pub-cache/hosted/www.example.com错误: pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26:^^^^^^^^^^^^^^^^/C:/src/flutter/. pub-cache/hosted/www.example.com错误:没有为类“返回”定义方法“返回”。 www. example.com Error: Type 'DiagnosticableMixin' not found. abstract class PictureStreamCompleter with DiagnosticableMixin { ^^^^^^^^^^^^^^^^^^^ /C:/src/flutter/flutter/.pub-cache/hosted/ pub.dartlang.org/flutter_datetime_picker-1.3.8/lib/src/datetime_picker_theme.dart:6:7: Error: The type 'DiagnosticableMixin' can't be mixed in. class DatePickerTheme with DiagnosticableMixin { ^ /C:/src/flutter/flutter/.pub-cache/hosted/ pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:7: Error: The type 'DiagnosticableMixin' can't be mixed in. class PictureStream with DiagnosticableMixin { ^ /C:/src/flutter/flutter/.pub-cache/hosted/ pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:16: Error: The type 'DiagnosticableMixin' can't be mixed in. abstract class PictureStreamCompleter with DiagnosticableMixin { ^ /C:/src/flutter/flutter/.pub-cache/hosted/ pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:167:11: Error: Superclass has no method named 'debugFillProperties'. super.debugFillProperties(properties); ^^^^^^^^^^^^^^^^^^^ /C:/src/flutter/flutter/.pub-cache/hosted/ pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:171:30: Error: The method 'toStringShort' isn't defined for the class 'PictureStreamCompleter'.

  • "PictureStreamCompleter"来自"package:flutter_svg/src/picture_stream. dart"('/C:/src/flutter/flutter/. pub-cache/hosted/pub.dartlang. org/flutter_svg-0.17.4/lib/src/picture_stream. dart')。请尝试将名称更正为现有方法的名称,或定义一个名为"toStringShort"的方法。如果存在:_completer?. toStringShort(),^^^^^^^^^^^^/C:/src/flutter/flutter/. pub-cache/hosted/www.example.com错误:超类没有名为"调试填充属性"的方法。pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:266:11: Error: Superclass has no method named 'debugFillProperties'. super.debugFillProperties(description); ^^^^^^^^^^^^^^^^^^^

失败:生成失败,出现异常。

  • 其中:脚本"C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter. gradle"行:896
  • 出了什么问题:任务":app:compileFlutterBuildDebug"的执行失败。

进程"命令" C:\src\flutter\flutter\bin\flutter.bat "已完成,退出值为非零值1

  • 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。使用--scan运行以获取完整的见解。
  • https://help.gradle.org获取更多帮助

构建在1m 12s内失败,异常:Gradle任务assembleDebug失败,退出代码为1已退出(sigterm)

xwmevbvl

xwmevbvl1#

dependency_overrides: flutter_svg: 0.18.0

在您的pubspec.yaml中

ghhaqwfi

ghhaqwfi2#

我也遇到了和你一样的错误,我的解决方案是把flutter_svg包更新到最新版本,所以我建议你进入你的pubspec.yaml,在dependencies下做以下事情:

flutter_svg: 0.18.0

然后运行pub get,希望错误会消失。

3npbholx

3npbholx3#

To change dependency:

 flutter_svg: ^0.17.4  to flutter_svg: ^0.18.0

然后,

flutter pub get
flutter clean

然后,运行

w3nuxt5m

w3nuxt5m4#

尝试将程序包编写为:

flutter_svg: ^0.20.0-nullsafety
mzmfm0qo

mzmfm0qo5#

为了解决这个问题,在pubspec.yaml中进行了以下更新

Flutter_svg: ^0.18.0
flutter_html: ^1.0.2
flutter_widget_from_html: 0.4.3

这三个依赖项导致的大多数错误

c8ib6hqw

c8ib6hqw6#

我找到了解决方案去检查this链接。我升级了Flutter和dart到最新版本,最后我得到了一个很好的结果。

xtupzzrd

xtupzzrd7#

这为我解决了这个问题,在你的pubspec.yaml文件依赖列表中使用这个flutter_svg: ^0.20.0-nullsafety

相关问题