为啥 Flutter 编译器告诉我我的应用程序不存在?

Posted

技术标签:

【中文标题】为啥 Flutter 编译器告诉我我的应用程序不存在?【英文标题】:Why does Flutter compiler tell me that my app doesn't exist?为什么 Flutter 编译器告诉我我的应用程序不存在? 【发布时间】:2019-10-07 14:52:45 【问题描述】:

我正在使用 Flutter 制作应用程序,我需要从 Firestore 数据库中获取一些数据。我按照步骤将其包含在 ios Xcode 项目中,但在 Xcode 构建后出现错误。我什至还没有在应用程序中使用 Firebase。

我找到了这个答案:App getting crash when click on GoogleSignIn button

但这不符合我的问题。

这是 AppDelegate.m(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

这是我得到的错误:

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

这是 Flutter 医生的输出:

[✓] 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!

编辑 创建一个干净的项目后,错误仍然存​​在。 所以我做了以下事情:

将我所有的插件升级到最新版本 迁移到 Android X 将 [FIRApp configure]; 移动到 AppDelegate.m 中其余 Objective-C 指令的上方(是的!)

【问题讨论】:

【参考方案1】:

我终于找到了解决办法。 创建一个干净的项目后,错误仍然存​​在。所以我做了以下事情:

将我所有的插件升级到最新版本 迁移到 Android X 移动 [FIRApp 配置];高于 AppDelegate.m 中的其余 Objective-C 指令(是的!)

【讨论】:

以上是关于为啥 Flutter 编译器告诉我我的应用程序不存在?的主要内容,如果未能解决你的问题,请参考以下文章

为啥 Game Maker Studio 告诉我我的 if 语句不起作用?

为啥 OpenGL 告诉我我已经使用了 GL_STATIC_DRAW 而我已经指定了其他方式?

为啥 Microsoft Graph API 告诉我我刚刚创建的事件仍然存在时被“@removed”?

为啥这个 C 向量循环不自动向量化?

为啥我的 Flutter 应用在​​ iOS 上启动时会崩溃?

Qt 告诉我我的 SLOT 不存在,但是通过 make clean,让它不再抱怨