【问题标题】:Flutter fatal error: could not build module 'firebase_core' - Flutter v2 iOS - firebase_core 1.2.0Flutter 致命错误:无法构建模块 'firebase_core' - Flutter v2 iOS - firebase_core 1.2.0
【发布时间】:2021-08-08 02:04:50
【问题描述】:

我正在尝试为 iOS 构建。我刚刚更新到 Flutter v2 和所有 firebase 最新版本(截至 2021 年 5 月 18 日)。当前的 firebase 核心版本是 1.2.0 。但是,我遇到了这个错误

 1 error generated.
/{my_user_path}/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage-8.1.0/ios/Classes/FLTFirebaseSto
ragePlugin.m:6:9: fatal error: could not build module 'firebase_core'
#import <firebase_core/FLTFirebasePluginRegistry.h>

我之前没有得到,我能够构建和部署好的。这是 Flutter 和 Firebase 更新后的最新版本。

没有多少 'flutter clean' 和删除 podfile.lock 的工作。

Xcode 输出:

Xcode's output:
/Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDLJavaScriptExecut
or.m:158:12: warning: unused function 'processIsTranslated' [-Wunused-function]
static int processIsTranslated() {
           ^
1 warning generated.
/Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDLJavaScriptExecut
or.m:158:12: warning: unused function 'processIsTranslated' [-Wunused-function]
static int processIsTranslated() {
           ^
1 warning generated.
/Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/FirebaseFirestore/Firestore/Source/API/FIRLoadBundleTask.mm:41:29:
warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'NSInteger' (aka 'int')
[-Wshorten-64-to-32]
    _bytesLoaded = progress.bytes_loaded();
                 ~ ~~~~~~~~~^~~~~~~~~~~~~~
/Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/FirebaseFirestore/Firestore/Source/API/FIRLoadBundleTask.mm:43:28:
warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'NSInteger' (aka 'int')
[-Wshorten-64-to-32]
    _totalBytes = progress.total_bytes();
                ~ ~~~~~~~~~^~~~~~~~~~~~~
/Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/FirebaseFirestore/Firestore/Source/API/FIRLoadBundleTask.mm:97:17:
warning: implicit conversion loses integer precision: 'firebase::firestore::api::LoadBundleTask::LoadBundleHandle' (aka
'long long') to 'FIRLoadBundleObserverHandle' (aka 'int') [-Wshorten-64-to-32]
  return _task->Observe(std::move(core_observer));
  ~~~~~~ ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
While building module 'firebase_core' imported from
/Users/abdelrahman/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage-8.1.0/ios/Classes/FLTFirebaseSto
ragePlugin.m:6:
In file included from <module-includes>:1:
In file included from /Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/Target Support
Files/firebase_core/firebase_core-umbrella.h:13:
In file included from
/Users/abdelrahman/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.2.0/ios/Classes/FLTFirebaseCorePl
ugin.h:11:
/Users/abdelrahman/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.2.0/ios/Classes/FLTFirebasePlugin
.h:9:9: error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin':
'/Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h'
[-Werror,-Wnon-modular-include-in-framework-module]
#import <FirebaseCore/FirebaseCore.h>
        ^
1 error generated.
/Users/abdelrahman/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage-8.1.0/ios/Classes/FLTFirebaseSto
ragePlugin.m:6:9: fatal error: could not build module 'firebase_core'
#import <firebase_core/FLTFirebasePluginRegistry.h>
 ~~~~~~~^
2 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Encountered error while building for device.

Firebase 版本:

cloud_firestore:2.2.0

firebase_auth:1.2.0

firebase_core:1.2.0

firebase_storage:8.1.0

firebase_messaging:10.0.0

【问题讨论】:

    标签: firebase flutter flutter-ios


    【解决方案1】:

    在完成所有步骤之后,除了将颤振更新到 v2.2.0 之外,我也遵循了这个答案。我相信我之前在 v2.0.6 上。 链接:Facing build issue after updating the flutter

    【讨论】:

      【解决方案2】:

      当我升级到最新版本的flutter和packages时,我遇到了一些类似的情况。

      在某些情况下,除了“flutter clean”之外,解决方案是修复 pub 缓存。

      dart pub cache repair
      

      对我有用的“序列”也是:

      • 删除 Flutter.podspec (ios/Flutter/Flutter.podspec)

      • 删除 podfile.lock

      • 删除 pod 目录

      • dart pub cache repair

      • pod install (或构建)

      【讨论】:

      • 尝试了这两种解决方案,但不幸的是它们都不起作用。使用与输出相同的味精。
      • 我用输出和 firebase 版本更新了基本问题。
      猜你喜欢
      • 2021-08-06
      • 2022-07-28
      • 2021-12-17
      • 2020-06-06
      • 2020-05-11
      • 2021-09-09
      • 2021-06-28
      • 2021-06-05
      • 2021-06-02
      相关资源
      最近更新 更多