[📚] Adding a new Flutter App from the Console leads to inevitable errors #9169
Labels
good first issue
Good for newcomers
resolution: invalid
This doesn't seem right and might not belong here.
Stale
Issue with no recent activity
type: documentation
Improvements or additions to documentation
type: enhancement
New feature or request
type: infrastructure
Improvements to the codebase
Hi there,
Firebase is a useful platform, but when it comes to configuring, the dev experience is just... bad. The following is constructive criticism and I hope this is usefeul I am working from a MacOS Monterey v12.3.1.
Let's reproduce the following steps:
This leads to the following steps:
firebase login
(easy)flutter create
. I personally like to run the following instead:flutter create myapp --org com.mydomain --platforms ios,android
, just to be suredart pub global activate flutterfire_cli
... okflutterfire configure --project=[...]
and follow another sequence of sub-stepsWhich are:
google-plist
andgoogle.json
files. This is nice!Then, we follow-up an easy initialization with the last step, after step 7. of the previous list.
8. Add
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
just to test the initialization.flutter pub add firebase_core
Without adding the core package, obviously the initialization won't work. Now, I know this is trivial, but let's follow along the instructions.
Ok, let's try and follow that link. I see a list of plugins. Ok, let's try and add Analytics then, click.
The quick start feels nice, there's a dedicated "Flutter" button. Great. Here are more steps:
flutter pub add firebase_analytics
flutter run
Flutter Fix
prompts us the following:Mhh... This is another smell. I'd rather expect to run another round of
flutterfire configure --project=in-for-school
, so that this detail is hidden from me. But no worries, let's just change that, and make this happen withflutter run
.This time it works!
Let's see if
flutter run
works with anios
build.⛔️ Woops, it doesn't!
A very long and very scary list of errors / logs appear on my screen. Some are red, some aren't. What's going on?
After 30 minutes of googling I discover this has to do - again - with the minimum iOS version. Online, this looks like common knowledge. Is it really, though? It is not very easy to alter the minimum iOS target version. First try:
Runner.xcworkspace
with XCode.10
.Works. Again, this must be documented. Even better, I'd like
flutterfire configure
to do this for me in my place. This is a detail I should be notified, but I shouldn't take care of this directly.Let's try and add
cloud_firestore
now. Then, I click the plugin link.⛔️⛔️ There is zero documentation about Flutter installation, usage or anything else. Again, I must search online. I found out that the old Flutter Fire documentation (which was GREAT) is still available. It feels "dangerous", though, to follow an archived piece of documentation (that's how these pages are marked). Will it work? Let's see.
The page recommends:
flutter pub add cloud_firestore
to initflutter run
.multidex support
(which I had to read on about to understand what it was). No offense, but this is an implementation detail I really shouldn't be aware of. Luckily, the CLI prompts me to enable multidex support for Android. Ok, I hityes
.Just like before, I feel like this step should be handled by a middle
flutterfire configure
CLI invocation that handles the configuration of new plugins, each time I add a new one.Allright, at t his point let's try
flutter run
on my iOS simulator. Let's see.flutter run
.Oh, I see! Point 4 of the aforementioned archived guide says "(optional) Improve iOS & macOS build times". I know I sound redundant, but this really is yet another implementation detail I really shouldn't be aware of. Having
flutterfire configure
handle this for us just sounds... great!But anyways, let's follow these new steps and see what happens.
ios/Podfile
. The line is:pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.15.0'
target 'Runner' do
gem install cocoapods
... ⛔️ Error. This outputs:At this point, I'm not gonna lie. I have been not been productive for quite a while, just to make a demo app work. Something is definitively wrong with the docs and/or myself, I guess.
Let's try
flutter clean && flutter pub get && flutter run
, maybe it just works.⛔️⛔️ No, it doesn't.
Ok, let's try and run
cd ios && pod repo update && cd ../
. Ok, let's try that again. `flutter clean && flutter pub get && flutter run``.⛔️⛔️⛔️ Nope; that doesn't work. Looks like the error is the same and it is way longer than that. Up above, it says:
```Resolving dependencies of
Podfile
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because
checking is only performed in repo update
[!] CocoaPods could not find compatible versions for pod "FirebaseFirestore":
In snapshot (Podfile.lock):
FirebaseFirestore (= 9.2.0, ~> 9.2.0)
Which - and I'm just guessing here! - must be a conflict between the resolved version from the CDN (the line we added in the Podfile) and the actual Firestore version used. At this point I'm very frustrated. I must Google... something related to this problem. I find out there's a whole repo dedicated just to this problem.
It looks like the true repo to be included in the Podfile is the
9.2.0
version. So, now, I addedpod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '9.2.0'
instead.Will it work? Let's
cd ios && pod repo update && cd ../
andflutter clean && flutter pub get && flutter run
again.⛔️⚠️ ⛔️ No, it doesn't. The good news?
pod install
worked. The bad news? XCode build failed (yes, upon a simple demo app........). The error is just indecipherable for me. But here it is:At this point, I'm stopping using Firebase and I'm looking up for another solutions online.
If you felt frustrated by reading this, this is my Firebase experience. Consider that I use the product since the last two years. If you feel that issue is very long and verbose, well, this is actually what your user (developer) experience is at this moment in time.
I think that (besides the bugs) the documentation and the experience should be greatly improved:
flutterfire config
CLI must be improved and should be central into adding firebase plugins into flutterBecause of these three points, to me Firebase just feels unusable on Flutter. It really feels clunky, which is exactly what I'm trying to avoid when I'm looking at Firebase. I'm looking for a smooth, easy, quick way to setup a Backend-as-a-Service platform.
Hope this helps.
The text was updated successfully, but these errors were encountered: