【问题标题】:Error: Type 'TableMetadata' not found | FAILURE: Build failed with an exception错误:找不到类型“表元数据”| FAILURE:构建失败并出现异常
【发布时间】:2021-05-19 04:52:08
【问题描述】:

我是 Flutter 的新手,我遇到了这个问题,在清理构建(flutter clean)后,我的代码停止工作并且卡在构建失败中。..

我尝试删除 Flutter SDK 并再次执行该过程,但仍然收到相同的错误消息。

我试图修复 Firebase 登录并替换了“google-services.json”文件,然后在这些命令颤动 [clean build, pub get and 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

我试图搜索这个构建失败的问题,但我无法修复它。

【问题讨论】:

    标签: android flutter dart gradle visual-studio-code


    【解决方案1】:

    在您应用的 pubspec.yaml 文件中查找以下行:flutter_widget_from_html 并使用版本 ^ 0.5.1 + 3

    例如:flutter_widget_from_html:^0.5.1+3

    然后点击 pub upgrade 并运行您的应用

    【讨论】:

    • 谢谢你,按照你说的降级软件包效果很好
    【解决方案2】:

    “最简单的解决方法是运行 flutter pub upgrade 以确保 flutter_widget_from_htmlflutter_widget_from_html_core 一起更新。”

    在升级 pub 之前,您应该将 pubspec.yaml 中的最新软件包版本限制为 flutter_widget_from_html: ^0.5.2

    关于信用和更多信息see here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-28
      • 2018-10-22
      • 1970-01-01
      • 2018-10-29
      • 2020-06-13
      • 2021-09-24
      • 2016-05-18
      相关资源
      最近更新 更多