繁体   English   中英

Flutter 带有“cloud_firestore”的 pod 安装错误

[英]Flutter pod install error with 'cloud_firestore'

我有一台带 M1 芯片的 Mac。 当我尝试使用“cloud_firestore”package 调试 flutter 项目时,出现以下错误:

Analyzing dependencies
    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `cloud_firestore` from `.symlinks/plugins/cloud_firestore/ios`
    cloud_firestore: Using Firebase SDK version '8.10.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_auth` from `.symlinks/plugins/firebase_auth/ios`
    firebase_auth: Using Firebase SDK version '8.10.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
    firebase_core: Using Firebase SDK version '8.10.0' defined in 'firebase_core'
    -> Fetching podspec for `geolocator_apple` from `.symlinks/plugins/geolocator_apple/ios`
    -> Fetching podspec for `google_maps_flutter` from `.symlinks/plugins/google_maps_flutter/ios`
    -> Fetching podspec for `location` from `.symlinks/plugins/location/ios`
    -> Fetching podspec for `maps_launcher` from `.symlinks/plugins/maps_launcher/ios`
    -> Fetching podspec for `path_provider_ios` from `.symlinks/plugins/path_provider_ios/ios`
    -> Fetching podspec for `url_launcher_ios` from `.symlinks/plugins/url_launcher_ios/ios`
    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
    [!] CocoaPods could not find compatible versions for pod "cloud_firestore":
      In Podfile:
        cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`)
    Specs satisfying the `cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`)` dependency were found, but they required a higher minimum deployment target.
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:317:in `raise_error_unless_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:299:in `block in unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `tap'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:682:in `attempt_to_activate'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:254:in `process_topmost_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:94:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1078:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:416:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:240:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:161:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'
Error output from CocoaPods:
↳
    [!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Error running pod install
Error launching application on iPhone 13.

我努力了:

1- Go 到 Podfile 并将“平台:ios,'8.0'”更改为 9.0 和 10.0

2- flutter 干净 > flutter 酒吧得到

3- 我删除了 pod 并运行 pod install

4-同时运行此命令:

arch -x86_64 pod 更新

arch -x86_64 pod install --repo-更新

但仍然遇到同样的错误。 任何帮助如何解决这个问题?

我解决了这个问题。

问题出在“main.dart”中。 我从这个改变了'主要' function :

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(MyApp());
}

对此:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );
  runApp(MyApp());
}

所以,我认为 Firebase.initializeApp() 上的 options 参数现在是必需的。 使用 FlutterFire CLI 添加选项解决了我的问题。 此外,这里的文档: https://firebase.flutter.dev/docs/cli

我找到了另一个对我有用的解决方案。 我认为问题源于默认的 cocoapods 安装,按照 cocoapods 首页上的说明,其 FFI(国外 ZC1C425268E683854F1AB5074C17A 接口)存在一些 M1 不兼容性。

改为通过自制软件安装 cocoapods,确保您获得的是与苹果芯片兼容的版本。

这些说明对我有用。

但归结为卸载 cocoapods并通过自制软件重新安装:

冲泡安装 cocoapods

1- sudo arch -x86_64 gem install ffi

2- arch -x86_64 pod install

firebase 的较新版本需要一些更新,这对我有用

将 pubspec 上的 firebase 更新到最新版本,然后运行以下

firebase login

dart pub global activate flutterfire_cli

flutterfire configure

删除过时的 Podfile.lock 文件

rm ios/Podfile.lock

更新了 Podfile

pod repo update

构建项目

flutter build ios

试试这个组合:

  1. remove.symlinks && /Pods && podfile.lock
  2. 吊舱解体
  3. pod 回购更新
  4. 吊舱安装

尝试运行它!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM