【问题标题】:Pod install Firebase/Analytics failsPod 安装 Firebase/Analytics 失败
【发布时间】:2021-01-14 16:42:24
【问题描述】:

我正在使用 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 位于我的 flutter 项目的 ios 文件夹中

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

【问题讨论】:

  • 在将firebase集成到flutter for ios时,您不需要触摸Podfile和AppDelegate。您只需在 Xcode 中添加 GoogleService-Info.plist 文件。您遵循的说明适用于本机 iOS 设置。 reference.

标签: ios firebase flutter cocoapods firebase-analytics


【解决方案1】:

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

pod repo update

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

sudo gem install cocoapods 

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

编辑:

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

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

dependencies:
  firebase_analytics: ^6.0.0

查看here了解更多详情。

注意:在开发 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

【讨论】:

  • 我收到此错误(请参阅下一条评论中的完成,因为评论限制,我无法在此处发布)Updating spec repo `cocoapods` $ C:/Program Files/Git/cmd/git.exe -C C:/Users/H.Abbas/.cocoapods/repos/cocoapods fetch origin --progress remote: Enumerating objects: 27, done. remote: Counting objects: 100% (27/27), done. remote: Compressing objects: 100% (17/17), done. remote: Total 18 (delta 11), reused 0 (delta 0), pack-reused 0 From https://github.com/CocoaPods/Specs c5b0d40f05b1..98ceea0f4d61 master -> origin/master
  • $C:/Program Files/Git/cmd/git.exe -CC:/Users/H.Abbas/.cocoapods/repos/cocoapods rev-parse --abbrev-ref HEAD master $C :/Program Files/Git/cmd/git.exe -CC:/Users/H.Abbas/.cocoapods/repos/cocoapods reset --hard origin/master error: invalid path 'Specs/c/f/f/XCActionSheet. /0.0.2/XCActionSheet..podspec.json' 致命:无法将索引文件重置为修订版'origin/master'。
  • 是的!我从 Firebase 网站向其添加了 Firebase/Analtytics
【解决方案2】:

pod 'Firebase/Analytics' 应添加在“end”关键字之前。目前您已在“end”关键字之后添加它。 希望我的回答能解决你的问题

【讨论】:

    【解决方案3】:

    您的 pod 必须介于 targetend 关键字之间。

    target 'Runner' do
          
        //Comment the next line if you don't want to use dynamic frameworks
        use_frameworks!
          pod 'Firebase/Analytics'
    
    end
    

    【讨论】:

      猜你喜欢
      • 2022-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-22
      • 2021-01-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多