Why does Flutter compiler tell me that my app doesn't exist?

I'm making an app with Flutter and I need to fetch some data from a Firestore database. I followed the steps to include it in the iOS Xcode project, but I get an error after Xcode build. I am not even using Firebase yet in the app.

I found this answer: App getting crash when click on GoogleSignIn button

But it does not correspond to my problem.

This is the AppDelegate.m (no error reported by Xcode):

#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "GoogleMaps/GoogleMaps.h"

@import Firebase;

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [GMSServices provideAPIKey:@"XXXX"];
  [GeneratedPluginRegistrant registerWithRegistry:self];
    [FIRApp configure];
  // Override point for customization after application launch.
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

@end

This is the error I get:

Launching lib/main.dart on iPhone 8 in debug mode...
Running Xcode build...
Xcode build done.                                            7,8s
Configuring the default Firebase app...
6.0.0 - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.
6.0.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60000000 started
6.0.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see XXXX)
Configured the default Firebase app __FIRAPP_DEFAULT.
6.0.0 - [Firebase/Core][I-COR000027] The library name (flutter-firebase_core) or version number (0.4.0+1) contain invalid characters. Only alphanumeric, dash, underscore and period characters are allowed.
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010f5d26fb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x000000010eb76ac5 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010f5d2555 +[NSException raise:format:] + 197
    3   Runner                              0x00000001076ca6b6 +[FIRApp configureWithName:options:] + 326
    4   Runner                              0x00000001076ca54f +[FIRApp configureWithOptions:] + 143
    5   Runner                              0x00000001076ca47f +[FIRApp configure] + 607
    6   Runner                              0x000000010757e61c -[AppDelegate application:didFinishLaunchingWithOptions:] + 156
    7   UIKitCore                           0x0000000119a83311 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 280
    8   UIKitCore                           0<…>
Error connecting to the service protocol: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:54573/It0MI4dOUXE=/ws

And this is Flutter doctor output:

[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.4 18E226, locale fr-FR)
    • Flutter version 1.5.4-hotfix.2 at /Users/mickaeldebalme/SDK/Flutter/flutter
    • Framework revision 7a4c33425d (3 weeks ago), 2019-04-29 11:05:24 -0700
    • Engine revision 52c7a1e849
    • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)


[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/mickaeldebalme/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Users/mickaeldebalme/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/182.5314842/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • ios-deploy 1.9.4
    • CocoaPods version 1.6.1

[✓] Android Studio (version 3.3)
    • Android Studio at /Users/mickaeldebalme/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/182.5314842/Android Studio.app/Contents
    • Flutter plugin version 34.0.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] Connected device (1 available)
    • iPhone 8 • B6399A10-1F2D-44C3-8B0D-6AD086AD0F55 • ios •
      com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)

• No issues found!

EDIT After creating a clean project, the error was still there. So I did the following:

  • Upgrading all my plugins to the latest version
  • Migrating to Android X
  • Moving the [FIRApp configure]; above the [FIRApp configure]; (yes !)

1 answer

  • answered 2019-05-21 16:11 Mickaël D

    I finally found a solution. After creating a clean project, the error was still there. So I did the following:

    Upgrading all my plugins to the latest version Migrating to Android X Moving the [FIRApp configure]; above the [FIRApp configure]; (yes !)