当我尝试 运行 我的 flutter 应用程序时构建失败

Build failed when I try to run my flutter app

当我尝试 运行 我的应用程序时,我附加了我在调试控制台中得到的内容。

这些是我的 firebase 依赖项

 firebase_core: ^1.12.0
 firebase_auth: ^3.3.8
 cloud_firestore: ^3.1.9
Launching lib\main.dart on ***** in debug mode...
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-6.2.0/lib/src/method_channel/utils/exception.dart:14:11: Error: Method not found: 'Error.throwWithStackTrace'.
    Error.throwWithStackTrace(exception, stackTrace);
          ^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-6.2.0/lib/src/method_channel/utils/exception.dart:17:9: Error: Method not found: 'Error.throwWithStackTrace'.
  Error.throwWithStackTrace(
        ^^^^^^^^^^^^^^^^^^^

/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-6.2.0/lib/src/method_channel/utils/exception.dart:12:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
Never convertPlatformException(Object exception, StackTrace stackTrace) {
      ^

FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\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 21s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

我试过很多方法,但都没有用。

尝试 flutter clean 然后 flutter 运行 它对我有用

颤动版本 2.10.4

我的第一个猜测是您可能无法完成 platform-specific installation/setup for Firebase 以及 Firebase 插件。

只是为了确认您可以访问 FlutterFire 网站,该网站将指导您完成 Firebase 目标平台和插件设置的安装步骤;

否则,flutter clean 和 flutter pub get 应该可以解决问题。

但是,问题仍然存在,您可以重新启动编辑器,然后 运行 命令 flutter pub get / flutter pub upgrade。