CocoaPods 找不到 pod“Firebase/CoreOnly”的兼容版本

Luc*_*ini 69 ios firebase podspec flutter podfile

我已经将我的 flutter 包更新到最新版本,现在 IOS 不再工作了。

当我尝试更新 Pod 时,它显示此错误:

    [!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly":
    In Podfile:
    cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 0.0.1, which depends on
    Firebase/Firestore (~> 6.0) was resolved to 6.0.0, which depends on
    Firebase/CoreOnly (= 6.0.0)

    cloud_functions (from `.symlinks/plugins/cloud_functions/ios`) was resolved to 0.0.1, which depends on
    Firebase/Functions (~> 5.18) was resolved to 5.18.0, which depends on
    Firebase/CoreOnly (= 5.18.0)
Run Code Online (Sandbox Code Playgroud)

这是我的 pubspec.yaml(与 Firebase 相关):

firebase_core: "^0.4.0"
firebase_auth: "^0.11.0"
firebase_analytics: "^3.0.0"  
cloud_firestore: "^0.11.0+1"
cloud_functions: "^0.3.0"
firebase_storage: "^3.0.0"
firebase_messaging: "^5.0.1"
Run Code Online (Sandbox Code Playgroud)

我已经采取了各种步骤来尝试修复:

flutter clean
flutter build ios

pod install
pod update
pod repo update
pod install --repo-update
Run Code Online (Sandbox Code Playgroud)

我已经在 Podfile 和 Xcode 中将平台 :ios, '12.1' 设置为构建目标,但没有任何恢复。

这是我的 podfile:

# Uncomment this line to define a global platform for your project
platform :ios, '12.1'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
      plugin = line.split(pattern=separator)
      if plugin.length == 2
        podname = plugin[0].strip()
        path = plugin[1].strip()
        podpath = File.expand_path("#{path}", file_abs_path)
        pods_ary.push({:name => podname, :path => podpath});
      else
        puts "Invalid plugin specification: #{line}"
      end
  }
  return pods_ary
end

target 'Runner' do
  use_frameworks!

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')

  # Flutter Pods
  generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
  if generated_xcode_build_settings.empty?
    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
  end
  generated_xcode_build_settings.map { |p|
    if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
      symlink = File.join('.symlinks', 'flutter')
      File.symlink(File.dirname(p[:path]), symlink)
      pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
    end
  }

  # Plugin Pods
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.map { |p|
    symlink = File.join('.symlinks', 'plugins', p[:name])
    File.symlink(p[:path], symlink)
    pod p[:name], :path => File.join(symlink, 'ios')
  }
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

Moh*_*bil 132

试试打电话 pod repo update

如果问题没有解决

删除根目录下的Podfile.lock,然后运行 pod install

  • `rm -rf Podfile.lock` 然后 `pod install` 对我有用。 (36认同)
  • `rm -rf Podfile.lock && pod install --repo-update` 谢谢@Mohhamed Nabil (6认同)
  • flutter 3 不适合我 (5认同)
  • 对于 M1 Mac:alias pod="arch -x86_64 pod" (2认同)

Ari*_*ios 113

对于 M1 Mac 用户

  1. 转到ios/Pods/Local Podspecs项目中的目录
  2. 检查每个json文件以找到所需的最高 iOS 版本。我的"ios": "10.0"在其中一些
  3. 返回到ios/ directory
  4. 打开Podfile文件
  5. 取消注释# platform :ios, '9.0'并替换9.0为步骤 2 中的版本。- 例如 10.0

接下来是M1具体部分

  1. 跑步sudo arch -x86_64 gem install ffi

  2. 跑步arch -x86_64 pod repo update

  3. 运行arch -x86_64 pod install错误应该消失了

  4. 如果使用 Fluttercd - 返回根目录 - 打开 iOS Simulator 并运行flutter run

如果不起作用,您可能需要在第 1 步之前运行flutter pub add firebase_core将 firebase_core 添加到您的pubspec.yaml文件中


如果仍然不起作用,请尝试以下奖励步骤:

  • 尝试直接从 Xcode 运行?flutter build ios首先在 Flutter 项目中运行-> 然后在 Xcode 中运行

  • 仍然无法cd iOS运行rm -rf Pods/ Podfile.lock ; pod install

  • 还是行不通 ?在 Spotlight 中搜索 Keychain Access -> 打开 -> 右键登录 -> 解锁(构建成功后将锁定)

  • 还是行不通 ?Xcode 运行器信息屏幕截图确保您的跑步者信息配置如下所示


小智 81

编辑 podfile 中的最低 ios 版本,然后运行 ​​pod install。

更改platform :ios, '9.0'platform :ios, '10.0'然后运行pod install为我修复了它。

  • 当我在 Xcode 中将“Runner”->“Runner”->“Info”->“iOS Deployment Target”更改为版本 >= 10.0.0 时,工作完美 (2认同)

mah*_*mnj 27

如果您使用的是 M1 mac。

通过运行删除 podfile.lock

arch -x86_64 rm -rf Podfile.lock
Run Code Online (Sandbox Code Playgroud)

然后通过运行更新 pod

arch -x86_64 pod install --repo-update
Run Code Online (Sandbox Code Playgroud)


小智 21

只需做一个pod update然后pod install。这对我有用。


Anu*_*pta 16

对于 M1 Mac 来说

\n

在最后一部分中找到答案是最简单、最快的。

\n

移动到文件夹ios:

\n
cd ios\n
Run Code Online (Sandbox Code Playgroud)\n
\n

方法一:

\n
\n

打开终端并运行

\n
sudo gem uninstall cocoapods\nsudo gem install cocoapods\n
Run Code Online (Sandbox Code Playgroud)\n

重新启动 IDE 或编辑器

\n
\n

方法二:

\n
\n

注意:仅当方法 1不起作用时才尝试

\n

现在是时候为M1 Mac安装 pod 了:

\n
 sudo arch -x86_64 gem install ffi\n arch -x86_64 pod repo update\n arch -x86_64 pod install\n
Run Code Online (Sandbox Code Playgroud)\n

现在99% 的安装错误应该消失了

\n

现在只有 1% 的可能性您仍然会收到错误:

\n

打开您的 ios Runner XCode 项目并按照图像说明进行操作。

\n

更改目标架构中排除的架构

\n
form i386 to arm64 i386 (Note: space is important)\n
Run Code Online (Sandbox Code Playgroud)\n

在此输入图像描述

\n

现在返回根目录并运行

\n
 flutter run\n
Run Code Online (Sandbox Code Playgroud)\n
\n

另外,重新启动你的编辑器。

\n
\n
\n

预先说明:

\n
\n

多次出现此错误并每次复制粘贴即可修复该错误。\n因此,我在此提供一种借助方法 2 实现此目的的更好方法:

\n

复制下面的书面代码

\n
#!/bin/bash\n\npwd\nsudo arch -x86_64 gem install ffi\narch -x86_64 pod repo update\narch -x86_64 pod install\n
Run Code Online (Sandbox Code Playgroud)\n

您需要在 IOS 文件夹中创建一个脚本文件,我们将其命名为pod_install.sh \n如果您再次遇到相同的问题,您只需运行一个命令即可。

\n
sh pod_install.sh \n
Run Code Online (Sandbox Code Playgroud)\n

从你的 ios 文件夹中

\n

现在输入你的mac的密码

\n

现在喝茶 \xe2\x98\x95 时间

\n
\n

不要忘记重新启动编辑器。

\n
\n


Adr*_*uri 14

  1. 执行 flutter clean

  2. 转到ios/文件夹,编辑Podfile并选择要启动的平台和版本。例如对于平台ios和版本12.0

播客文件

# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
Run Code Online (Sandbox Code Playgroud)
  1. 执行 pod update

  2. 执行pod install(下载依赖项可能需要几分钟时间)

  3. 执行 flutter run


Par*_*iya 10

您只需要更新 pod repo。您的 cocopods 存储库可能已过期

按照此命令更新您的 pod

  1. flutter clean
  2. pod repo update
  3. 删除/ios/Pods//ios/Podfile.lock
  4. pod install


Ala*_*ine 9

=== 2023 年四月更新 ===

从 2023 年 4 月开始,您必须执行以下操作:

编辑iod/Podfile并编辑/修改或取消注释此行:

platform :ios, '11.0'
Run Code Online (Sandbox Code Playgroud)

保存文件并在 ios 目录中执行以下命令:

rm -rf Podfile.lock && pod install --repo-update
Run Code Online (Sandbox Code Playgroud)


awa*_*aik 8

2021 年 3 月

cloud_firestore: ^1.0.0

cd ios
rm Podfile.lock
pod repo update
Run Code Online (Sandbox Code Playgroud)


ner*_*ovs 8

在此处输入图片说明

要在 ^1.0.3 版本中使用“firebase_core”依赖项,“iOS 部署目标”必须不低于“10.0”


Afi*_* EM 7

这个简单的解决方案对我有用(由 IDE 本身建议)

pod install --repo-update
Run Code Online (Sandbox Code Playgroud)

在终端 IOs 文件夹中运行命令


Eri*_*ett 6

我在尝试将 Firebase Analytics 添加到我的项目时遇到了同样的问题。我一直在终端中运行 pod update,但在确保 pubspec.yaml 文件中的所有 flutter 包都是最新版本之前,我无法成功进入 FirebaseCore (6.0.0)。

1)我摆脱了导致错误的包。对我来说,它是 Firebase Analytics,因为我刚刚将它添加到我的项目中。

2) 我浏览了所有的 firebase 包,并确保我的 pubspec.yaml 中有最新版本。他们来了:

firebase_core: ^0.4.0
firebase_database: ^3.0.0
firebase_auth: ^0.11.0
firebase_storage: ^3.0.0
Run Code Online (Sandbox Code Playgroud)

3) 导航到 ios 文件夹并运行 pod update

4) 将 Firebase Analytics 包(或您有兴趣添加的任何内容)添加到 pubspec.yaml。

5)运行包获取

6) 在终端运行 pod install


Aay*_*rya 5

在 React Native 中

cd ios

rm -rf Podfile.lock

pod install
Run Code Online (Sandbox Code Playgroud)


归档时间:

查看次数:

44099 次

最近记录:

4 年,10 月 前