首页 > 解决方案 > Pod 安装 Firebase/Analytics 失败

问题描述

我正在使用 Window 10 并尝试使用 Pod 与之集成Firebase/Analyticsflutter一切似乎都很好,除了我在运行时遇到此错误pod install

这里是stackTrace


 

    CocoaPods : 1.9.3
            Ruby : ruby 2.6.6p146 (2020-03-31 revision 67876) [x64-mingw32]
        RubyGems : 3.0.3
            Host : Unable to find an executable (No such file or directory - sw_vers)  ()
           Xcode : -version) ()
             Git : git version 2.27.0.windows.1
    Ruby lib dir : F:/Ruby26-x64/lib
    Repositories : trunk - CDN - https://cdn.cocoapods.org/

这是我的Pod文件


# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'Runner' do
  
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  # Pods for Runner


end

  # add the Firebase pod for Google Analytics
  pod 'Firebase/Analytics'
  # add pods for any other desired Firebase products
  # https://firebase.google.com/docs/ios/setup#available-pods


在我podfile的项目ios文件夹中flutter

你能帮我解决这个问题吗?

标签: iosfirebasefluttercocoapodsfirebase-analytics

解决方案


您需要更新 pod 存储库。因此,请从命令行尝试以下命令。

pod repo update

如果错误仍然存​​在,那么您可能需要升级可可豆荚。

sudo gem install cocoapods 

在我的颤振项目中集成 Firebase 存储时,我遇到了同样的错误。我做到pod repo update了,问题消失了。

编辑:

如果您在 pod 文件中手动添加了 firebase 分析 pod,则只需将其删除。

您需要在 Flutter 项目的 .yaml 文件中添加依赖项。

dependencies:
  firebase_analytics: ^6.0.0

在这里查看更多详情。

注意:在 Flutter 项目上工作时,除非有非常特殊的要求,否则不需要使用 pod(iOS) 或 gradle(android) 安装任何库。

如果有任何特定的平台要求,那么您需要为 iOS 项目添加 pod 文件,如下所示...

您需要在目标 'Runner' do...end 块中编写 pod 'Firebase/Analytics' 行,如下所示...

 # Uncomment the next line to define a global platform for your project
 platform :ios, '10.0'

 target 'Runner' do

    # Comment the next line if you don't want to use dynamic frameworks
   use_frameworks!

    # Pods for Runner

  # add the Firebase pod for Google Analytics
    pod 'Firebase/Analytics'

end

推荐阅读