Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[📚] Adding a new Flutter App from the Console leads to inevitable errors #9169

Closed
lucavenir opened this issue Jul 20, 2022 · 5 comments
Closed
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

Comments

@lucavenir
Copy link

lucavenir commented Jul 20, 2022

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:

  1. Create a new Firebase Project
  2. Follow the instructions to add a new Flutter App.

This leads to the following steps:

  1. Install the Firebase CLI (ok, easy)
  2. Install the Flutter SDK (obvious, but ok, we got this)
  3. Run firebase login (easy)
  4. Run flutter create. I personally like to run the following instead: flutter create myapp --org com.mydomain --platforms ios,android, just to be sure
  5. Run dart pub global activate flutterfire_cli... ok
  6. Dang, a warning pops out, I need to set the environment variable or else I won't be able to do the following steps... (ugh, ok)
  7. Run flutterfire configure --project=[...] and follow another sequence of sub-steps

Which are:

  1. Prompt the target platforms. Okay, easy: android, ios
  2. The CLI fetches and registers the apps. I can see via GIT diff that it is adding the google-plist and google.json files. This is nice!
  3. Everything goes smooth. Ok.

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.

⚠️ Here's a first smell I encountered. It is not instructed to run the following to make the above code work.
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.

Then, add and begin using the Flutter plugins for the Firebase products you'd like to use.

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:

  1. First, add the package. Ok, flutter pub add firebase_analytics
  2. Then, just run the application. Ok,flutter run

⚠️ Something went wrong with gradle here. Luckily enough, Flutter Fix prompts us the following:

│ The plugin firebase_analytics requires a higher Android SDK version.                   │
│ Fix this issue by adding the following to the file                                     │
│ /Users/lucavenir/Documents/Testing123/folder/myproject/android/app/build.gradle:    │
│ android {                                                                              │
│   defaultConfig {                                                                      │
│     minSdkVersion 19                                                                   │
│   }                                                                                    │
│ }                                                                                      │
│                                                                                        │
│                                                                                        │
│ Note that your app won't be available to users running Android SDKs below 19.          │
│ Alternatively, try to find a version of this plugin that supports these lower versions │
│ of the Android SDK.                                                                    │
│ For more information, see:                                                             │
│ https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration          │

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 with flutter run.
This time it works!

Let's see if flutter run works with an ios 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:

  1. I tried to open Runner.xcworkspace with XCode.
  2. "Runner" --> "Build Settings"
  3. Search filter on top right, "ios"
  4. "iOS deployment target" pops out
  5. Change that to 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:

  1. flutter pub add cloud_firestore to init
  2. Then, just flutter run.

⚠️ The build step fails. And mentions 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 hit yes.
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.

⚠️ Okay... This is taking a little while. Like, a while. No, I mean, A LOT. 300 seconds more or less. Consider that I have a brand new Desktop Mac.
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.

  1. Just add one line of code to ios/Podfile. The line is: pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.15.0'
  2. Such line must be located just after target 'Runner' do
  3. Then, run gem install cocoapods... ⛔️ Error. This outputs:
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory

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.

    [!] Automatically assigning platform `iOS` with version `10.0` on target `Runner`
    because no platform was specified. Please specify a platform for this target in your
    Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.
To update the CocoaPods specs, run:
  pod repo update

Error running pod install
Error launching application on iPhone 8.

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)

  In Podfile:
    FirebaseFirestore (from
    `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `8.15.0`)

None of your spec sources contain a spec satisfying the dependencies:
`FirebaseFirestore (from
`https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `8.15.0`),
FirebaseFirestore (= 9.2.0, ~> 9.2.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod
 install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.
 * ```

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 added pod '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 ../ and flutter 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:

Error output from Xcode build:
    objc[57489]: Class AppleTypeCRetimerRestoreInfoHelper is implemented in both
    /usr/lib/libauthinstall.dylib (0x212e49eb0) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Mobi
    leDevice (0x105bb44f8). One of the two will be used. Which one is undefined.
    objc[57489]: Class AppleTypeCRetimerFirmwareAggregateRequestCreator is implemented in
    both /usr/lib/libauthinstall.dylib (0x212e49f00) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Mobi
    leDevice (0x105bb4548). One of the two will be used. Which one is undefined.
    objc[57489]: Class AppleTypeCRetimerFirmwareRequestCreator is implemented in both
    /usr/lib/libauthinstall.dylib (0x212e49f50) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Mobi
    leDevice (0x105bb4598). One of the two will be used. Which one is undefined.
    objc[57489]: Class ATCRTRestoreInfoFTABFile is implemented in both
    /usr/lib/libauthinstall.dylib (0x212e49fa0) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Mobi
    leDevice (0x105bb45e8). One of the two will be used. Which one is undefined.
    objc[57489]: Class AppleTypeCRetimerFirmwareCopier is implemented in both
    /usr/lib/libauthinstall.dylib (0x212e49ff0) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Mobi
    leDevice (0x105bb4638). One of the two will be used. Which one is undefined.
    objc[57489]: Class ATCRTRestoreInfoFTABSubfile is implemented in both
    /usr/lib/libauthinstall.dylib (0x212e4a040) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Mobi
    leDevice (0x105bb4688). One of the two will be used. Which one is undefined.
    2022-07-20 19:11:58.878 xcodebuild[57489:566379] Requested but did not find extension
    point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension
    Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in
    com.apple.dt.IDEWatchSupportCore
    2022-07-20 19:11:58.878 xcodebuild[57489:566379] Requested but did not find extension
    point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for
    extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of
    plug-in com.apple.dt.IDEWatchSupportCore
    ** BUILD FAILED **


Xcode's output:

    Writing result bundle at path:
    	/var/folders/vp/z7j2d77d2gqbw60zjyfjy58h0000gn/T/flutter_tools.Cdjp7Z/flutter_ios_bui
    	ld_temp_dirEU2VAF/temporary_xcresult_bundle

    warning: [CP] BoringSSL-GRPC.xcframework: Unable to find matching slice in 'ios-arm64
    ios-arm64_x86_64-maccatalyst ios-arm64_x86_64-simulator' for the current build
    architectures (arm64 x86_64 i386) and platform (-iphonesimulator).
    warning: [CP] FirebaseFirestore.xcframework: Unable to find matching slice in
    'ios-arm64_x86_64-simulator ios-arm64_x86_64-maccatalyst ios-arm64' for the current
    build architectures (arm64 x86_64 i386) and platform (-iphonesimulator).
    warning: [CP] FirebaseFirestoreSwift.xcframework: Unable to find matching slice in
    'ios-arm64 ios-arm64_x86_64-maccatalyst ios-arm64_x86_64-simulator' for the current
    build architectures (arm64 x86_64 i386) and platform (-iphonesimulator).
    warning: [CP] Libuv-gRPC.xcframework: Unable to find matching slice in
    'ios-arm64_x86_64-simulator ios-arm64 ios-arm64_x86_64-maccatalyst' for the current
    build architectures (arm64 x86_64 i386) and platform (-iphonesimulator).
    warning: [CP] abseil.xcframework: Unable to find matching slice in 'ios-arm64
    ios-arm64_x86_64-simulator ios-arm64_x86_64-maccatalyst' for the current build
    architectures (arm64 x86_64 i386) and platform (-iphonesimulator).
    warning: [CP] gRPC-C++.xcframework: Unable to find matching slice in
    'ios-arm64_x86_64-simulator ios-arm64 ios-arm64_x86_64-maccatalyst' for the current
    build architectures (arm64 x86_64 i386) and platform (-iphonesimulator).
    warning: [CP] gRPC-Core.xcframework: Unable to find matching slice in
    'ios-arm64_x86_64-maccatalyst ios-arm64_x86_64-simulator ios-arm64' for the current
    build architectures (arm64 x86_64 i386) and platform (-iphonesimulator).
    warning: [CP] leveldb-library.xcframework: Unable to find matching slice in 'ios-arm64
    ios-arm64_x86_64-maccatalyst ios-arm64_x86_64-simulator' for the current build
    architectures (arm64 x86_64 i386) and platform (-iphonesimulator).
    In file included from
    /Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/
    FLTSnapshotsInSyncStreamHandler.m:8:
    /Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/
    Private/FLTFirebaseFirestoreUtils.h:43:4: error: expected a type
    + (FIRFirestoreSource)FIRFirestoreSourceFromArguments:(NSDictionary
    *_Nonnull)arguments;
       ^
    /Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/
    Private/FLTFirebaseFirestoreUtils.h:45:4: error: expected a type
    + (FIRFirestore *_Nullable)getCachedFIRFirestoreInstanceForKey:(NSString
    *_Nonnull)key;
       ^
    /Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/
    Private/FLTFirebaseFirestoreUtils.h:46:40: error: expected a type
    + (void)setCachedFIRFirestoreInstance:(FIRFirestore *_Nonnull)firestore
                                           ^
    /Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/
    FLTSnapshotsInSyncStreamHandler.m:12:33: error: no type or protocol named
    'FIRListenerRegistration'
    @property(readwrite, strong) id<FIRListenerRegistration> listenerRegistration;
                                    ^
    /Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/
    FLTSnapshotsInSyncStreamHandler.m:19:3: error: use of undeclared identifier
    'FIRFirestore'
      FIRFirestore *firestore = arguments[@"firestore"];
      ^
    /Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/
    FLTSnapshotsInSyncStreamHandler.m:19:17: error: use of undeclared identifier
    'firestore'
      FIRFirestore *firestore = arguments[@"firestore"];
                    ^
    /Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/
    FLTSnapshotsInSyncStreamHandler.m:27:32: error: use of undeclared identifier
    'firestore'
      self.listenerRegistration = [firestore addSnapshotsInSyncListener:listener];
                                   ^
    /Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/
    FLTSnapshotsInSyncStreamHandler.m:33:30: error: no known instance method for selector
    'remove'
      [self.listenerRegistration remove];
                                 ^~~~~~
    8 errors generated.
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order

    Result bundle written to path:
    	/var/folders/vp/z7j2d77d2gqbw60zjyfjy58h0000gn/T/flutter_tools.Cdjp7Z/flutter_ios_bui
    	ld_temp_dirEU2VAF/temporary_xcresult_bundle


Parse Issue (Xcode): Expected a type
/Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/Priv
ate/FLTFirebaseFirestoreUtils.h:42:3


Parse Issue (Xcode): Expected a type
/Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/Priv
ate/FLTFirebaseFirestoreUtils.h:44:3


Parse Issue (Xcode): Expected a type
/Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/Priv
ate/FLTFirebaseFirestoreUtils.h:45:39


Generics Issue (Xcode): No type or protocol named 'FIRListenerRegistration'
/Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/FLTS
napshotsInSyncStreamHandler.m:11:32


Semantic Issue (Xcode): Use of undeclared identifier 'FIRFirestore'
/Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/FLTS
napshotsInSyncStreamHandler.m:18:2


Semantic Issue (Xcode): Use of undeclared identifier 'firestore'
/Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/FLTS
napshotsInSyncStreamHandler.m:18:16


Semantic Issue (Xcode): Use of undeclared identifier 'firestore'
/Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/FLTS
napshotsInSyncStreamHandler.m:26:31


ARC Semantic Issue (Xcode): No known instance method for selector 'remove'
/Users/lucavenir/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.3.0/ios/Classes/FLTS
napshotsInSyncStreamHandler.m:32:29


Could not build the application for the simulator.
Error launching application on iPhone 8.

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:

  1. The flutterfire config CLI must be improved and should be central into adding firebase plugins into flutter
  2. The docs should be migrated to just one source and should (must) be clearer
  3. The iOS build times should be directly tackled by the Firebase team and not delegated to an external open source directory

Because 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.

@lucavenir lucavenir added good first issue Good for newcomers type: documentation Improvements or additions to documentation labels Jul 20, 2022
@darshankawar darshankawar added the triage Issue is currently being triaged. label Jul 21, 2022
@darshankawar
Copy link

Thanks for the detailed report @lucavenir.
Since flutterfire configure comes from CLI tool, it has a separate repo for tracking issues related to it, so, apart from the documentation changes you requested above for this repo, I suggest you to file an issue in dedicated repo too for the current behavior and enhancement you would like flutterfire configure to handle: https://github.com/invertase/flutterfire_cli/issues

@darshankawar darshankawar added type: enhancement New feature or request type: infrastructure Improvements to the codebase and removed triage Issue is currently being triaged. labels Jul 21, 2022
@lucavenir
Copy link
Author

Thank you for the response.

I'll sure open an issue there referencing this one. Thanks again.

Still, I think this issue is about points 2 and 3 (at the end): besides the documentation, why isn't the Firebase team tackling Flutter integration with Firebase, directly, instead of depending onto another repo?

@Dev-Muhammad-Junaid
Copy link

@lucavenir has gone through the exact similar issues you mentioned. Now going for alternate options
Clunky Documentation
IOS build times
They were initially quite good but now it just feel like we always have to work around with external sources to do so.

@russellwheatley russellwheatley added the Stale Issue with no recent activity label Feb 26, 2024
@Lyokone
Copy link
Contributor

Lyokone commented Mar 19, 2024

Closing this issue, please feel free to reopen if it still occurs using the latest version of FlutterFire plugins.

@Lyokone Lyokone closed this as completed Mar 19, 2024
@lucavenir
Copy link
Author

I didn't experience most of the pain points above in the last years. Also, re-reading my issue, I can smell some beginner bias in there (not that the lengthy errors were my fault).

You can close the related issue as well.

@TarekkMA TarekkMA added the resolution: invalid This doesn't seem right and might not belong here. label Apr 16, 2024
@firebase firebase locked and limited conversation to collaborators Apr 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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
Projects
None yet
Development

No branches or pull requests

6 participants