Xcode 构建失败,致命错误:@import firebase_auth找不到模块'firebase_auth';


Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.4, on Mac OS X 10.15.5 19F101, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.46.1)
[!] Connected device
! No devices available
! Doctor found issues in 1 category.

\\\错误信息

** BUILD FAILED **
Xcode's output:
↳
/Users/Razi/Desktop/projects/Sayy/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'firebase_auth' not found
@import firebase_auth;
~~~~~~~^~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description

我尝试删除 Podfile/Podlock 并运行pod init/pod install但没有成功。还查看了 iOS 文件夹的 GitHub 存储库。为什么找不到firebase_auth?

更新:我最终能够通过执行以下操作找到解决方法:

  1. 运行Flutter Clean(在项目的ios文件夹中(
  2. 删除PodlockPod Folder
  3. 跑步pod init后跟pod install

似乎是 runner.xcworkspace 文件夹和构建的问题 运行生成所需的文件。

我尝试按照建议的步骤执行Flutter clean,手动删除podfilepodfile.lock以及Pod相关的文件夹,再次执行pod install等 - 没有任何帮助。

最后对我有帮助的是以下顺序:

  1. 创建一个具有pubspec.yaml中声明的相同依赖项的新项目。
  2. 在新项目中运行pub get
  3. 在新项目中运行pod install以生成所有内容
  4. 将新生成的podfilepodfile.lock文件复制到旧项目中。
  5. 在旧项目中运行pod install

只有在这个序列之后,我才能再次构建iOS项目。

These steps helped me to resolve the issue completely for IOS:
>> flutter clean
then "delete podfile, podfile.lock, pod folder"
>> flutter pub get
>> pod install
>> flutter run
  1. 似乎您没有提供完整的 Podfile 内容(我在那里看不到有关 Sayy 目标的任何内容(,或者您一直在更改 Podfile

  2. 根据您尝试存档的内容,删除 Podfile 中的最后 3 行或将行"pod 'AFNetworking', '~> 3.0'"移动到"use_modular_headers!

  3. 在左侧边栏中打开XCode顶级项目(蓝色图标(->在最左侧的菜单中,您将看到两个部分 - 项目和目标。因此,在"目标"块中的名称 — 是唯一可以在关键字"target"之后出现在 Podfile 中

    的名称
  4. 一切都取决于:

  • 你需要AFNetworking吗?
  • 您的应用程序中有哪些目标

我已经摆脱了这个问题,购买取消注释 Podfile 中的行

platform :ios, '10.0'

同时删除清理您的项目并重新构建!

在构建设置中更改 ios 的部署目标 -> 在 xcode 或 podfile 中部署 将部署目标设置为大于 10

这是对我有用的东西

  1. 在 pub.dev 上查找最新版本的firebase_core/firebase_auth
  2. 清除ios文件夹中的Pods/Podfile.lock
  3. ios文件夹中运行pod install --repo-update(重要提示!

以下是对我有用的步骤:

  1. 删除 iOS>Pods

  2. 删除 ios>PodfilePodfile.lock

  3. 飘干净

  4. 颤振运行

按此顺序执行这三个命令后,pod 安装开始,并且已完成。

最新更新