我是 flutter 的新手,我面临这个问题,即在清理构建(flutter clean)后,我的代码停止工作并且卡在构建失败中..
我尝试删除 Flutter SDK 并再次执行该过程,但仍然收到相同的错误消息。
我试图修复 Firebase 登录并替换了“google-services.json”文件,然后在执行这些命令后 [clean build、pub get 和 pub upgrade] 代码卡在构建中。
(这是错误信息和 screenshot)
Running Gradle task 'assembleDebug'...
../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.5.1+5/lib/src/widget_factory.dart:60:57: Error: Type 'TableMetadata' not found.
Widget buildTable(BuildMetadata m, TextStyleHtml tsh, TableMetadata data) =>
^^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.5.1+5/lib/src/internal/layout_grid.dart:7:24: Error: Type 'TableMetadata' not found.
TextStyleHtml tsh, TableMetadata data) {
^^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.5.1+5/lib/src/widget_factory.dart:60:57: Error: 'TableMetadata' isn't a type.
Widget buildTable(BuildMetadata m, TextStyleHtml tsh, TableMetadata data) =>
^^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.5.1+5/lib/src/internal/layout_grid.dart:7:24: Error: 'TableMetadata' isn't a type.
TextStyleHtml tsh, TableMetadata data) {
^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'D:\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\Flutter\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 6m 10s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 376.2s (!)
Exception: Gradle task assembleDebug failed with exit code 1
我试图搜索这个构建失败的问题,但我无法修复它。
答案 0 :(得分:3)
在您应用的 pubspec.yaml 文件中查找此行:flutter_widget_from_html 并使用版本 ^ 0.5.1 + 3
例如:flutter_widget_from_html:^0.5.1+3
然后点击 pub upgrade 并运行您的应用
答案 1 :(得分:1)
“最简单的解决方法是运行 flutter pub upgrade
以确保同时更新 flutter_widget_from_html
和 flutter_widget_from_html_core
。”
在升级 pub 之前,您应该将 pubspec.yaml
中的最新软件包版本限制为 flutter_widget_from_html: ^0.5.2
信用和更多信息see here