【问题标题】:Flutter build error.(related to pub-cache)Flutter 构建错误。(与 pub-cache 相关)
【发布时间】:2020-11-29 02:02:50
【问题描述】:

当我尝试构建我的项目时,我在控制台中打印了此错误。

两天前一切正常。

这是错误,

Running "flutter pub get" in SampleApp...
Launching lib\main.dart on Android SDK built for x86 in debug mode...
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/top_level.dart:1:8: Error: Not found: 'dart:html'
import 'dart:html';
       ^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.2/lib/js.dart:8:1: Error: Not found: 'dart:js'
export 'dart:js' show allowInterop, allowInteropCaptureThis;
^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.2/lib/js_util.dart:8:1: Error: Not found: 'dart:js_util'
export 'dart:js_util';
^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type 'DiagnosticableMixin' not found.
class PictureStream with DiagnosticableMixin {
                         ^^^^^^^^^^^^^^^^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:44: Error: Type 'DiagnosticableMixin' not found.
abstract class PictureStreamCompleter with DiagnosticableMixin {
                                           ^^^^^^^^^^^^^^^^^^^

FAILURE: Build failed with an exception.

* Where:
Script 'E:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 896

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'E:\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 4m 13s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

我真的不知道为什么会这样,我尝试谷歌搜索但找不到任何有用的东西。

还有更多错误,与 .pub-cache 相关,但我没有发布,因为那样问题会太长。

请帮忙。

【问题讨论】:

    标签: firebase flutter gradle dart build.gradle


    【解决方案1】:

    错误在“Firebase”包中,删除它,它就可以工作了。

    【讨论】:

      【解决方案2】:

      为了具体说明需要做些什么来帮助看到此问题的其他人,我将在下面进行解释:

      当你以某种方式添加下面的导入语句时,你可能会看到这个问题:

      import 'package:firebase/firebase.dart';
      

      找到并删除上面的行,清理你的构建(通过运行flutter clean 命令)并再次运行。现在问题应该已经解决了。

      【讨论】:

        猜你喜欢
        • 2021-09-29
        • 2021-04-23
        • 2022-06-11
        • 2022-10-02
        • 2021-06-15
        • 2016-12-03
        • 2021-05-27
        • 2022-06-18
        • 2022-06-27
        相关资源
        最近更新 更多