简体   繁体   English

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

[英]Flutter pod install error with 'cloud_firestore'

I have a Mac with M1 chip.我有一台带 M1 芯片的 Mac。 When I'm trying to debug a flutter project with 'cloud_firestore' package I'm getting this error bellow:当我尝试使用“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.

I have tried:我努力了:

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

2- flutter clean > flutter pub get 2- flutter 干净 > flutter 酒吧得到

3- I deleted pod and run pod install 3- 我删除了 pod 并运行 pod install

4- Also run this commands: 4-同时运行此命令:

arch -x86_64 pod update arch -x86_64 pod 更新

arch -x86_64 pod install --repo-update arch -x86_64 pod install --repo-更新

But still getting same error.但仍然遇到同样的错误。 Any help how to fix this?任何帮助如何解决这个问题?

I solved the issue.我解决了这个问题。

Problem was in 'main.dart'.问题出在“main.dart”中。 I changed 'main' function from this:我从这个改变了'主要' function :

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

to this:对此:

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

So, I think options parameter on Firebase.initializeApp() is required now.所以,我认为 Firebase.initializeApp() 上的 options 参数现在是必需的。 Adding options with FlutterFire CLI solved my problem.使用 FlutterFire CLI 添加选项解决了我的问题。 Also, here documentation for this: https://firebase.flutter.dev/docs/cli此外,这里的文档: https://firebase.flutter.dev/docs/cli

I found another solution that worked for me.我找到了另一个对我有用的解决方案。 I think the problem stems from the default cocoapods install, as instructed on the cocoapods front page, has some M1 incompatibilities with its FFI (foreign function interface).我认为问题源于默认的 cocoapods 安装,按照 cocoapods 首页上的说明,其 FFI(国外 ZC1C425268E683854F1AB5074C17A 接口)存在一些 M1 不兼容性。

Installing cocoapods via homebrew instead, ensures that you are getting an apple silicon compatible version.改为通过自制软件安装 cocoapods,确保您获得的是与苹果芯片兼容的版本。

These instructions worked for me. 这些说明对我有用。

But it boils down to uninstalling cocoapods and reinstalling it via homebrew:但归结为卸载 cocoapods并通过自制软件重新安装:

brew install cocoapods冲泡安装 cocoapods

1- sudo arch -x86_64 gem install ffi 1- sudo arch -x86_64 gem install ffi

2- arch -x86_64 pod install 2- arch -x86_64 pod install

The newer versions of firebase requires some updating and this is what worked for me firebase 的较新版本需要一些更新,这对我有用

updated firebase on pubspec to latest version then ran the following将 pubspec 上的 firebase 更新到最新版本,然后运行以下

firebase login

dart pub global activate flutterfire_cli

flutterfire configure

deleted outdated Podfile.lock file删除过时的 Podfile.lock 文件

rm ios/Podfile.lock

updated the Podfile更新了 Podfile

pod repo update

build the project构建项目

flutter build ios

try this combination:试试这个组合:

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

Try run it!尝试运行它!

暂无
暂无

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

相关问题 Flutter on IOS:致命错误:找不到模块“cloud_firestore” - Flutter on IOS: fatal error: module 'cloud_firestore' not found CocoaPods 找不到 pod“Firebase/Core”的兼容版本 | cloud_firestore,Flutter - CocoaPods could not find compatible versions for pod "Firebase/Core” | cloud_firestore, Flutter 未找到模块“Cloud_Firestore” - XCode - Flutter - Module 'Cloud_Firestore' not found - XCode - Flutter Flutter cloud_firestore:^2.0.0 构建失败 - Flutter cloud_firestore: ^2.0.0 build failure Flutter:[Cloud_firestore] 发布模式下没有数据 - Flutter : [Cloud_firestore] no data in release mode Flutter Web:未捕获(承诺)错误:[cloud_firestore/unknown] NoSuchMethodError:null 上的无效成员:'includeMetadataChanges' - Flutter Web: Uncaught (in promise) Error: [cloud_firestore/unknown] NoSuchMethodError: invalid member on null: 'includeMetadataChanges' 从 Flutter 中的 Firestore 查询单个文档(cloud_firestore Plugin) - Query a single document from Firestore in Flutter (cloud_firestore Plugin) 未找到模块“cloud_firestore”:BigSur VM 上的 Flutter - Module 'cloud_firestore' not found: Flutter on BigSur VM 为什么 select() function 在 Flutter 的 cloud_firestore package 中不可用? - Why is the select() function not available in Flutter's cloud_firestore package? 无法安装 cloud_firestore 所需的 BoringSSL-GRPC (0.0.7) - Not able to install BoringSSL-GRPC (0.0.7) required by cloud_firestore
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM