Flutterfire: [Messaging] flutter_driver and firebase_messaging are incompatible

Created on 24 Aug 2020  ·  15Comments  ·  Source: FirebaseExtended/flutterfire

Description
Firebase Messaging (7.0.0) and latest Flutter Master (1.22.0-2.0.pre.36) doesn't work.

Error

Because every version of flutter_driver from sdk depends on platform 3.0.0-nullsafety.1 and firebase_messaging 7.0.0 depends on platform ^2.0.0, flutter_driver from sdk is incompatible with firebase_messaging 7.0.0.
And because no versions of firebase_messaging match >7.0.0 <8.0.0, flutter_driver from sdk is incompatible with firebase_messaging ^7.0.0.
So, because fluid depends on both firebase_messaging ^7.0.0 and flutter_driver any from sdk, version solving failed.

pubspec.yaml

name: firebase_messaging_test_driver
description: A new Flutter application.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.3
  firebase_messaging: ^7.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_driver:
    sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  # assets:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

To Reproduce

  1. Create new project;
  2. Copy-Paste to pubspec.yaml (only added flutter_driver and firebase_messaging)
  3. Write flutter pub get
  4. Error will appear.

Expected behavior
Libs should be retrieved without an error.

Additional context
Works fine in Flutter 1.21.0-10.0.pre.139,.
Original Topic https://github.com/flutter/flutter/issues/64312

Flutter doctor

[✓] Flutter (Channel master, 1.22.0-2.0.pre.36, on macOS 11.0 20A5354i, locale en-HK)
    • Flutter version 1.22.0-2.0.pre.36 at /Users/mac/FlutterProject/flutter
    • Framework revision d30e36ba8c (2 days ago), 2020-08-21 22:36:03 -0400
    • Engine revision d495da20d0
    • Dart version 2.10.0 (build 2.10.0-49.0.dev)


[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/mac/Library/Android/sdk
    • Platform android-30, build-tools 28.0.3
    • ANDROID_SDK_ROOT = /Users/mac/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
    • Xcode at /Users/mac/Downloads/Xcode-beta.app/Contents/Developer
    • Xcode 12.0, Build version 12A8179i
    • CocoaPods version 1.9.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.47.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.9.1

[✓] Connected device (3 available)
    • ONEPLUS A6000 (mobile) • 2b4e4866   • android-arm64  • Android 10 (API 29)
    • Web Server (web)       • web-server • web-javascript • Flutter Tools
    • Chrome (web)           • chrome     • web-javascript • Google Chrome 84.0.4147.135

• No issues found!

messaging

Most helpful comment

A quick fix that seems to satisfy the install command now:

dependency_overrides:
  # For firebase_messaging
  platform: 3.0.0-nullsafety.1

It's a tough time for a lot of packages right now because we're halfway between migrating everything for NNBD coming soon. It's gonna be a rocky migration for flutter devs.

All 15 comments

Issue replicable on latest Master (1.22.0-2.0.pre.36). Doesn't occur on latest stable though (1.20.2)

Because every version of flutter_driver from sdk depends on platform 3.0.0-nullsafety.1 and firebase_messaging 7.0.0 depends on platform ^2.0.0, flutter_driver from sdk is incompatible with firebase_messaging 7.0.0.

And because no versions of firebase_messaging match >7.0.0 <8.0.0, flutter_driver from sdk is incompatible with firebase_messaging ^7.0.0.

So, because test_bug depends on both firebase_messaging ^7.0.0 and flutter_driver any from sdk, version solving failed.
pub get failed (1; So, because test_bug depends on both firebase_messaging ^7.0.0 and flutter_driver any from sdk, version solving failed.)

I also tried with other firebase plugins (eg: firebase_core, firebase_auth) which compiles properly along with flutter driver, but issue seems to be happening only with firebase_messaging.

The same setup works on previous master version (1.21.0-10.0.pre.139).

We should move e2e tests & driver dev dependency to the example app in messaging. No reason they need to stay as dev deps on the plugin itself - would someone be willing to send up a PR to do that?

hello any update on this one ? i had to move to Beta Branch to make my project compile again with messaging 7.0.0. Thanks !

Hey @yvrez I've made the PR that fixes the issue, it is still to be reviewed (https://github.com/FirebaseExtended/flutterfire/pull/3343)

In the meantime, you can just use the package directly

firebase_messaging:
    git:
      url: git://github.com/preetjdp/flutterfire.git
      ref: fix-3312
      path: packages/firebase_messaging

thanks @preetjdp thanks i'm going to do that !

Any update on this? Flutter 1.22 was just pushed to the Flutter beta channel this morning.

Hey @yvrez I've made the PR that fixes the issue, it is still to be reviewed (#3343)

In the meantime, you can just use the package directly

firebase_messaging:
    git:
      url: git://github.com/preetjdp/flutterfire.git
      ref: fix-3312
      path: packages/firebase_messaging

hmm, not working from here:

pub upgrade failed (server unavailable) -- attempting retry 6 in 32 seconds...
Package doesn't exist (the pubspec for firebase_messaging 7.0.1 from git has version 7.0.0).

@kauaicreative I would just fork flutterfire yourself for now and remove the platform dependency from the pubspec.yaml of firebase_messaging and import that in your project until it's done

@Ehesp do you know if we'll have a quick fix for this on your new branch anytime soon?

A quick fix that seems to satisfy the install command now:

dependency_overrides:
  # For firebase_messaging
  platform: 3.0.0-nullsafety.1

It's a tough time for a lot of packages right now because we're halfway between migrating everything for NNBD coming soon. It's gonna be a rocky migration for flutter devs.

cc @Salakar in the current release of flutter, only the stable branch is able to use this package the moment.

Currently in the process of reworking messaging - have removed the platform dependency altogether. I'll get someone to look into sorting this in a patch.

@Ehesp Any updates on this? :)

@MrAlek Messaging rework was announced yesterday https://twitter.com/mikediarmid/status/1319298281290203139. I believe this should solve this issue?

@dackers86 Just saw this, thanks for the link!

Looks amazing, great work @Ehesp @Salakar & team 👏 Can't wait to try out!

Was this page helpful?
0 / 5 - 0 ratings