🐛 card_flutter fails to build on Android when host app includes firebase_core and firebase_messaging
Description
When integrating card_flutter into a Flutter app that uses firebase_core and firebase_messaging, the Android build fails due to a duplicate class error.
The error also occurs when building the bundled example app after adding these Firebase dependencies.
Steps to Reproduce
- Create a new Flutter app or use the provided
example app in card_flutter.
- Add the following dependencies to
pubspec.yaml:
dependencies:
firebase_core: ^2.30.0
firebase_messaging: ^14.7.10
- Run
flutter pub get.
- Build the app for Android:
flutter build apk --flavor qa --debug
Actual Result
Build fails with the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkQaReleaseDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class com.google.firebase.iid.FirebaseInstanceIdReceiver found in modules firebase-iid-20.1.5.aar (com.google.firebase:firebase-iid:20.1.5)
and firebase-messaging-24.1.1.aar (com.google.firebase:firebase-messaging:24.1.1)
Learn how to fix dependency resolution errors at https://d.android.com/r/tools/classpath-sync-errors
Expected Result
The app should build successfully with card_flutter, firebase_core, and firebase_messaging dependencies included.
Notes
- The issue appears to be caused by an outdated or conflicting transitive Firebase dependency.
- A resolution strategy or exclusion rule might be needed in
card_flutter's build.gradle to avoid pulling in deprecated Firebase libraries (like firebase-iid).
Please look into resolving this compatibility issue or provide guidance on an official workaround.
🐛
card_flutterfails to build on Android when host app includesfirebase_coreandfirebase_messagingDescription
When integrating
card_flutterinto a Flutter app that usesfirebase_coreandfirebase_messaging, the Android build fails due to a duplicate class error.The error also occurs when building the bundled example app after adding these Firebase dependencies.
Steps to Reproduce
exampleapp incard_flutter.pubspec.yaml:flutter pub get.Actual Result
Build fails with the following error:
Expected Result
The app should build successfully with
card_flutter,firebase_core, andfirebase_messagingdependencies included.Notes
card_flutter'sbuild.gradleto avoid pulling in deprecated Firebase libraries (likefirebase-iid).Please look into resolving this compatibility issue or provide guidance on an official workaround.