Flutter XCode-build 错误无法构建模块'firebase_core'

Posted

技术标签:

【中文标题】Flutter XCode-build 错误无法构建模块\'firebase_core\'【英文标题】:Flutter XCode-build error Could not build module 'firebase_core'Flutter XCode-build 错误无法构建模块'firebase_core' 【发布时间】:2021-08-06 12:43:07 【问题描述】:

在为 ios 构建应用程序时遇到以下错误:

Xcode's output:
↳
    While building module 'firebase_core' imported from /Users/amishra19/Library/android/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-2.1.0/ios/Classes/FLTQuerySnapshotStreamHandler.m:6:
    In file included from <module-includes>:1:
    In file included from /Users/amishra19/Documents/Projects/Apps/Mingo/Mingo_Flutter_App/mingo_application/ios/Pods/Target Support Files/firebase_core/firebase_core-umbrella.h:13:
    In file included from /Users/amishra19/Library/Android/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.1.1/ios/Classes/FLTFirebaseCorePlugin.h:11:
    /Users/amishra19/Library/Android/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.1.1/ios/Classes/FLTFirebasePlugin.h:9:9: error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin': '/Users/amishra19/Documents/Projects/Apps/Mingo/Mingo_Flutter_App/mingo_application/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
    #import <FirebaseCore/FirebaseCore.h>
            ^
    1 error generated.
    /Users/amishra19/Library/Android/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-2.1.0/ios/Classes/FLTQuerySnapshotStreamHandler.m:6:9: fatal error: could not build module 'firebase_core'
    #import <firebase_core/FLTFirebasePluginRegistry.h>
     ~~~~~~~^


This are the dependencies
dependencies:
  flutter:
    sdk: flutter
  provider: ^4.0.0
  cupertino_icons: ^0.1.2
  intl: ^0.17.0
  http: ^0.13.3
  shared_preferences: ^0.5.3+1
  flag: ^3.2.2
  device_info: ^2.0.0
  firebase_storage: ^8.0.6
  firebase_database: ^6.1.2
  firebase_core: ^1.0.0
  firebase_auth: ^1.1.4
  cloud_firestore: ^2.0.0
  flutter_easyloading: ^3.0.0
dev_dependencies:
  flutter_test:
    sdk: flutter

【问题讨论】:

【参考方案1】:

使用最新版本更新您的 firebase_core 包, 然后使用以下命令你的 ios 目录终端

    rm Podfile.lock rm Podfile 吊舱解体;吊舱安装

【讨论】:

以上是关于Flutter XCode-build 错误无法构建模块'firebase_core'的主要内容,如果未能解决你的问题,请参考以下文章

Flutter:无法找到“flutter_assets”错误的资产路径

Flutter错误无法启动守护进程

Flutter中的Webview无法正常工作,出现平台错误

无法检索 Flutter 项目中 Graphql 突变中发生的错误

即构音视频 Express Flutter SDK 全面支持空安全

第一个 Flutter App 错误:无法解析符号“属性”