Issue Including Firestore In Flutter App - google-cloud-firestore

I went through this codelab to integrate Google Firestore into my Flutter app but adding:
cloud_firestore: ^0.7.3
in my pubspec.yaml file breaks the app when I try to run it with
flutter run
The output of the error is:
What went wrong:
Execution failed for task ':app:processDebugManifest'.Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.4.0) from [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35
is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:26:9-28:38 to override.
My pubspec.yaml file dependencies are:
dependencies:
flutter:
sdk: flutter
image_picker: 0.1.1
google_sign_in: 0.3.1
firebase_analytics: 0.0.4
firebase_auth: 0.2.0
firebase_database: 0.0.12
firebase_storage: 0.0.5
charts_flutter: "^0.2.0"
cloud_firestore: "^0.7.3"
From some research, the issue seems to be something to do with SDK versions being incompatible. How do I go about debugging this issue?

Related

Flutter firebase - update packeges

I try to update firebase to nullsafe.
Here is my pubspec:
firebase_core: "^0.7.0"
firebase_auth: "^0.20.1"
firebase_crashlytics: "^0.4.0+1"
cloud_firestore: "^0.16.0+1"
cloud_functions: "^0.9.0"
firebase_storage: "^7.0.0"
firebase_messaging: "^8.0.0-dev.15"
firebase_remote_config: "^0.8.0-dev.0"
firebase_analytics: "^7.0.1"
firebase_database: "^6.0.0"
firebase_dynamic_links: "^0.7.0+1"
firebase_in_app_messaging: "^0.3.0+1"
firebase_performance: "^0.5.0+1"
But I can't do it because have an errors:
Because firebase_remote_config >=0.8.0-dev.0 <0.9.0-dev.0 depends on firebase_remote_config_platform_interface ^0.1.0-dev.0 which depends on firebase_core ^0.5.2, firebase_remote_config >=0.8.0-dev.0 <0.9.0-dev.0 requires firebase_core ^0.5.2.
So, because EMA depends on both firebase_core ^0.7.0 and firebase_remote_config ^0.8.0-dev.0, version solving failed.
Flutter Firebase dependency hell !!!
What to do?
Please show guaranteed working plugins firebase pluging(storage,auth,store,crashlitics)
You are getting version conflicts. You can solve them by letting pub find the version that is compatible with your other dependencies. Like this:
firebase_remote_config: any
If you get more of these errors, I suggest you to put all of packages to any then run flutter pub get and finally look in the pubspec.lock file and see what versions you got. Now you can put those versions in pubspec.yaml.

Flutter: Firebase Analytics not compatible with null safety

I tried to move my project to the new Dart and make it null safety compatible but seems firebase_analytics is still not ready.
How can I bypass this error, are they going to release firebase_analytics null safety soon?
I filed an issue here: https://github.com/FirebaseExtended/flutterfire/discussions/5108
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
firebase_core: ^0.8.0-1.0.nullsafety.2
firebase_messaging: ^9.0.0-1.0.nullsafety.1
firebase_analytics: ^7.0.1
firebase_crashlytics: ^0.5.0-1.0.nullsafety.3
When I compile I get this error :
Because firebase_analytics >=7.0.1 depends on firebase_core ^0.7.0 and ketab depends on firebase_core ^0.8.0-1.0.nullsafety.2, firebase_analytics >=7.0.1 is forbidden.
So, because yourapp depends on firebase_analytics ^7.0.1, version solving failed.
pub get failed (1; So, because yourapp depends on firebase_analytics ^7.0.1, version solving failed.)
FlutterFire by the moment dont have null safety coverage for all of their packages
1 You can fork flutter fire repo https://github.com/FirebaseExtended/flutterfire
then you can play with versions in pubspec of firebase_analytics
then just use own version like that
firebase_analytics:
git:
url: HERE_YOUR_FORKED_REPO_URL
path: packages/firebase_analytics/firebase_analytics
2 I had familiar problem recently, just removed version at all and now its worked for me))
firebase_auth: ^0.21.0-1.0.nullsafety.0
cloud_firestore: 0.17.0-1.0.nullsafety.2
firebase_analytics:

How to solve multi dependency version conflicts simply?

I have imported a project in android studio flutter. But, there is an incredible amount of version conflict coming in. If one solves other rises and if that goes down, other one rises. I am trying to get all packages and it is showing me the following error as below.
Because date_utils >=0.1.0+3 depends on intl ^0.16.0 and prokit_flutter depends on intl 0.17.0-nullsafety.2, date_utils >=0.1.0+3 is forbidden.
So, because prokit_flutter depends on date_utils ^0.1.0+3, version solving failed.
pub get failed (1; So, because prokit_flutter depends on date_utils ^0.1.0+3, version solving failed.)
Process finished with exit code 1
And my pubspec.yaml code is as below.
name: prokit_flutter
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.6.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
url_launcher: 5.0.3
nb_utils: 3.1.6+7
google_fonts: 1.1.0
animations: 1.1.2
intl: 0.17.0-nullsafety.2
http: 0.12.2
firebase_core: 0.5.0
firebase_analytics: 6.0.0
firebase_crashlytics: 0.1.4+1
google_sign_in: 4.5.3
html: 0.14.0+3
share: 0.6.5
mobx: ^1.2.1+2
flutter_mobx: ^1.1.0+2
flutter_statusbarcolor: 0.2.3
simple_animations: 1.3.8
snaplist: 0.1.8
flutter_svg: 0.18.1
flutter_slidable: 0.5.7
flutter_staggered_grid_view: 0.3.2
flutter_staggered_animations: 0.1.2
geolocator: 5.3.2+2
geocoder: 0.2.1
google_maps_flutter: 0.5.21+3
clustering_google_maps: 0.1.2
razorpay_flutter: 1.2.2
signature: 3.2.0
liquid_swipe: 1.5.0
lipsum: 1.0.1
flutter_colorpicker: 0.3.4
clippy_flutter: 1.1.1
flutter_tags: ^0.4.8
image_picker_gallery_camera: 0.1.6
video_player: 0.10.11+2
charts_flutter: ^0.9.0
like_button: ^1.0.1
flutter_reaction_button: ^1.0.1
lottie: ^0.6.0
showcaseview: ^0.1.6
date_utils: ^0.1.0+3
cached_network_image: ^2.3.1
flutter_localizations:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
mobx_codegen:
build_runner: ^1.9.0
#flutter packages pub run build_runner build
flutter:
uses-material-design: true
assets:
- images/smartDeck/images/
fonts:
- family: Andina
fonts:
- asset: fonts/andina.ttf
And there are 4-5 dependency version error. How can I solve this version error thing in one click or I can just somehow skip this version problem and get the thing done. Please help, Thanks in Advance.
Whenever conflicts between dependencies occur, the simplest solution is to just remove the version number of both that dependencies and type 'any' without quotes in front of them.
for example let's say this following two dependency conflicts:
shared_preferences: ^0.5.7+3
requests: ^3.3.0
then do following:
shared_preferences: any
requests: any
After this do pub get and issue will be resolved. Now, most importantly, don't leave any dependency on this form. instead goto pubspec.lock file and search these two dependencies. Flutter itself chooses the versions that don't conflict, copy those and replace it to pubsec.yaml
You can use dependency_overrides in your pubspec.yaml to force a specific package version. The package version will override any reference to a dependency in the entire app.
In your case you could use
dependencies:
flutter:
sdk: flutter
...
cupertino_icons: ^1.0.0
dependency_overrides:
intl: ^0.17.0-nullsafety.2
See dependency_overrides for more information.
Replace intl: 0.17.0-nullsafety.2 version with intl: 0.16.1 and remove intl from dependency overrides.
Now, run pub get command.
You can simply change the version of package that is causing conflic with another version which is compatible with your dart SDK. I tried it and the problem was solved.
had the same problem; ran the following command:
flutter pub upgrade --major-versions
if you don't mind having the latest version of all the dependencies while solving version conflict issues, this should be a quick fix.
I had this problem after resetting my Mac mini.
If you still have the pubspec.lock file at the last successful run (or get it from another dev, on that dev's computer the project is still running).
flutter clean.
Replace pubspec.lock by the old one.
Run the project again.

module 'cloud_firestore' not found (Flutter)

I am having this error when I am building my app with Xcode 'module 'cloud_firestore' not found. [enter image description here][1] I have updated my Cocoapods to 1.9.3 and I updated the flutter to 1.17.3, but still is not working and I am opening the file.xcworkspace.
Also, these are the versions of my dependencies:
flutter:
sdk: flutter
flutter_screenutil: ^1.0.2
intl: ^0.16.1
charts_flutter: ^0.8.1
flutter_picker:
git: git://github.com/yangyxd/flutter_picker.git
flutter_cupertino_data_picker: ^0.8.6
firebase_core: ^0.4.3+1
#firebase_analytics: ^5.0.9
firebase_auth: ^0.15.1
provider: ^4.0.4
flutter_spinkit: ^4.1.2
cupertino_icons: ^0.1.2
cloud_firestore: ^0.12.10
firebase_database: ^3.1.3
[1]: https://i.stack.imgur.com/ZPc71.png
from this
For anyone who is facing the problem when “Archiving” or trying to publish to the Apple Store:
Make sure to have all projects closed in Xcode
Open “Runner.xcworkspace” not runner.xcodeproj
You have to make sure that runner.xcodeproj is not open at the same time with workspace.
This is also assuming that you have run and built successfully prior to making an archive.
Update the firestore version:
cloud_firestore: ^0.13.6

After migrating to AndroidX build fails with latest dependencies

I created a new fresh Flutter project and then migrated it to AndroidX using Android studio without any issue. Then I added all the latest dependencies to my project. But as and when I am trying to run the application the build fails...
This version of cloud_firestore will break your Android build if it or its dependencies aren't compatible with AndroidX
Below are my pubspec.yaml dependencies...
cupertino_icons: ^0.1.2
firebase_auth: ^0.8.1+3
cloud_firestore: ^0.9.5+1
firebase_core: ^0.3.1
firebase_messaging: ^4.0.0+1
firebase_storage: ^2.1.0
intl_translation: ^0.17.3
http: ^0.12.0+1
xml: ^3.3.1
shared_preferences: ^0.5.1+1
flutter_staggered_grid_view: ^0.2.7
google_sign_in: ^4.0.1+1
flutter_signin_button: ^0.2.6
image_picker: ^0.5.0+3
I have taken all the latest dependencies that should be compatible with AndroidX. Is there any way to resolve this issue without downgrading to the pre Androidx?
Please help...
Thank you for your time...
use the cloud_firestore dependency which is compatible with androidx
cloud_firestore: 0.8.2+3
and follow this link to learn more about compatibility of flutter dependency with androidx. Use dependency which is mentioned here for your flutter dependency
https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility