【问题标题】:Can't build flutter ios with Firebase analytics running flutter build ios on codemagic.io cloud CI/CD无法使用在 codemagic.io 云 CI/CD 上运行 flutter build ios 的 Firebase 分析构建 Flutter ios
【发布时间】:2021-07-05 13:13:21
【问题描述】:

我已使用 XCodeGoogleService-Info.plist 添加到 ios\Runner

我创建了这个 Podfile

platform :ios, '10.0'

target 'Runner' do
  #use_frameworks!
  pod 'Firebase/Core'
  pod 'Firebase/Analytics'
end

pubspec.yaml

  firebase_core: ^1.0.2
  firebase_analytics: ^7.1.1

https://codemagic.io/ 上构建时仍然出现此错误

Xcode's output:
    /Users/builder/clone/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'firebase_analytics' not found
    @import firebase_analytics;

谢谢!!

【问题讨论】:

  • 尝试从ios/Podfile 中删除use_frameworks!,看看是否可行
  • 已经#d谢谢

标签: ios xcode flutter firebase-analytics codemagic


【解决方案1】:

好的,@Ashok 的回答是一个好的开始。删除旧的 Podfile 和其他内容后,运行 pod install 并创建一个新的 Podfile。你需要添加

platform :ios, '9.0' #uncomment this

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  pod 'Firebase/Analytics', '~> 7.3.0'  #Highest pod version that works with flutter firebase_analytics: ^7.1.1
...

也在AppFrameworkInfo.plist添加/编辑

  <key>MinimumOSVersion</key>
  <string>9.0</string>

【讨论】:

    【解决方案2】:
    1. Xcode 文件夹中删除DerivedData

      在你的flutter项目的ios文件夹中打开Runner.xcworkspace然后选择

      File -&gt; Workspace Settings -&gt; 点击DerivedData 路径旁边的灰色箭头,删除Xcode 文件夹内的DerivedData

    2. 在你的flutter项目的ios文件夹中删除Podfile

    3. 在你的flutter项目的ios文件夹中删除Podfile.lock

    4. 将部署目标更改为12.0

    5. 清理您的 ios 构建文件夹 (Command+Option+Shift+K) 或从 menu -&gt; Product,按键盘上的 Option,您将看到 Clean Build Folder

    6. 运行您的应用程序,它应该可以工作

    【讨论】:

    • 谢谢,但请注意我是在 codemagic.io CI/CD 上构建的,所以每次都运行干净的构建(没有 DerivedData 或 Podfile.lock)
    • 我还认为 10.0 足以用于 Firebase 分析,不是吗?再次感谢
    猜你喜欢
    • 2020-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-12
    • 2021-01-13
    • 2020-11-27
    • 2021-06-07
    • 1970-01-01
    相关资源
    最近更新 更多