【问题标题】:Unity fails to compile project with firebase analytics because of Cocoapods由于 Cocoapods,Unity 无法使用 Firebase 分析编译项目
【发布时间】:2018-02-19 12:42:48
【问题描述】:

我正在尝试将Firebase-Analytics 集成到我的Unity 2013.3.1 项目中。

关注integration guide后,我尝试构建项目。

但是,Unity 无法构建。原因好像是cocoapods

Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "Firebase/Analytics":
  In Podfile:
    Firebase/Analytics (= 4.8.1)

None of your spec sources contain a spec satisfying the dependency: `Firebase/Analytics (= 4.8.1)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

我尝试重新安装 cocoapods 并重新运行 pod setup,并删除 repo 并使用 rm -rf ~/.cocoapods/repos/master 重新设置,但没有成功。

这是生成的 Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'

target 'Unity-iPhone' do
pod 'Firebase/Analytics', '4.8.1'
pod 'Firebase/Core', '4.8.1'
end

我尝试的最后一件事是将特定版本标签删除到 Podfile 中(我删除了“4.8.1”)。这修复了 pod install,但是 我找不到从 unity 成功构建的方法,因为 Podfile 是自动生成的

这是移除版本标签后的 pod install 输出:

Analyzing dependencies
Downloading dependencies
Installing Firebase (4.9.0)
Installing FirebaseAnalytics (4.0.9)
Installing FirebaseCore (4.0.15)
Installing FirebaseInstanceID (2.0.9)
Installing GoogleToolboxForMac (2.1.3)
Installing nanopb (0.3.8)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `Unity-iPhone.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There are 2 dependencies from the Podfile and 6 total pods installed.

看起来FirebaseAnalytics 当前的版本是 4.0.9,而不是 4.8.1。

有没有人遇到过类似的问题?

【问题讨论】:

  • 两年后,这仍然是相关的。为什么选择 Google……为什么?

标签: ios firebase unity3d cocoapods firebase-analytics


【解决方案1】:

更新到4.4.2 release

或使用 4.4.1 解决方法:

手动编辑 Assets/Firebase/Editor 中的每个 Dependencies.xml 文件,将版本从 4.8.1 更改为 4.8.2。示例:

  <iosPods>
  <!-- Mike changed this from 4.8.1 to 4.8.2 -->
    <iosPod name="Firebase/Analytics" version="4.8.2" minTargetSdk="7.0">
    </iosPod>
  </iosPods>

参考和其他详细信息here

【讨论】:

    【解决方案2】:

    Firebase 4.9 使用的 FirebaseAnalytics 版本是 4.0.9,而不是 4.8.1。 See the podspec for reference.

    另一个可能失败的问题是您的依赖项 (iOS 7) 太旧,Xcode 9 和最新版本的 Firebase 都不支持它。

    替换

    platform :ios, '7.0'
    

    platform :ios, '8.0'
    

    【讨论】:

    • 我尝试使用 8.0,但仍然无法正常工作。 None of your spec sources contain a spec satisfying the dependency: Firebase/Analytics (= 4.8.1).
    • 好的,这似乎是 Unity 中的一个问题。确实,自动生成的 Podfile 被锁定为Firebase/Analytics 4.8.1,即使最后一个版本是4.0.9... uhm
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-21
    相关资源
    最近更新 更多