Reputation: 139
**/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_web-2.2.8/lib/src/internals.dart:11:10: Error: Method not found: 'guardWebExceptions'. return internals.guardWebExceptions( ^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:13:11:
Error: Method not found: 'Error.throwWithStackTrace'. Error.throwWithStackTrace(exception, stackTrace); ^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:16:9:
Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace( ^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:11:7:
Error: A non-null value must be returned since the return type 'Never' doesn't allow null. Never convertPlatformException(Object exception, StackTrace stackTrace) { ^ Failed to compile application.**
Upvotes: 13
Views: 24007
Reputation: 1
remove the firebase ^9.0.2 from the pubspec.yaml file because this partucular one is for Web apps and you're trying to build an android app
Upvotes: 0
Reputation: 53
As pointed out earlier by GarrettBarlocker, dependency overrides of all the firebase dependencies used in my project did the trick for me and it solved the problem.
Don't try flutter upgrade as it upgrades your project to the latest version of the flutter release. And it will force you to migrate your project to android v2 embedding as v1 embedding is deprecated in flutter 2.10.2 thereby failing to compile and build the application. Also, you may face compatibility issues with other dependencies.
Upvotes: 3
Reputation: 703
There were changes made to the dependencies of the Flutter Firebase packages https://github.com/FirebaseExtended/flutterfire/pull/8156
You can either update to use 2.16.0 version of dart or newer. Or override the dependencies, you only need to add the ones that you are using
dependency_overrides:
firebase_messaging_platform_interface: 3.1.6
firebase_storage_platform_interface: 4.0.14
cloud_functions_platform_interface: 5.0.21
cloud_firestore_platform_interface: 5.4.13
firebase_auth_platform_interface: 6.1.11
firebase_database_platform_interface: 0.2.0+5
Upvotes: 8
Reputation: 1285
I have faced the same problem and got a workaround for this.
override firebase_messaging_platform_interface in pubspeck.yaml:
dependency_overrides:
firebase_messaging_platform_interface: 3.1.6
check ref: https://github.com/FirebaseExtended/flutterfire/issues/8181
Upvotes: 2
Reputation: 2084
I found a solution for this.
I added it to my pubspeck.yaml:
dependency_overrides:
firebase_messaging_platform_interface: 3.1.6
Have a good day :)
Upvotes: 12