Home > Blockchain >  Build failed when I try to run my flutter app
Build failed when I try to run my flutter app

Time:04-05

I attached what I got in debug console when I try to run my app.

These are my firebase dependencies

 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)

I have tried many methods, But they didn't work.

CodePudding user response:

try flutter clean and then flutter run it work for me

flutter version 2.10.4

CodePudding user response:

My first guess is that you might not finish platform-specific installation/setup for Firebase as well as Firebase plugins.

Just to verify that You can visit the FlutterFire website which will guide you through the installation steps for the targeting platforms for Firebase and plugin setup;

Otherwise, the flutter clean and flutter pub get should do the trick.

However, a problem still exists, you can restart your editor and just run the command flutter pub get/ flutter pub upgrade.

  • Related