首页 > 解决方案 > 如何修复未在 Flutter 项目中安装的 Cloud Firestore 包?

问题描述

将 firebase cloud firestore 添加到我的项目依赖包中会使我的应用程序崩溃。当我与 youtube 教程一起编码时,我首先观察到了这个问题。现在,即使创建一个新的 Flutter 项目并添加 Cloud Firestore 依赖包,然后尝试构建该应用程序也无法正常工作。我该如何解决这个问题?

下面的示例是由 Flutter 构建的应用程序,用于创建一个新项目,并添加了一个 Cloud Firestore 依赖包。任何帮助表示赞赏。

发布规范.yaml


environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.3
  cloud_firestore: ^0.13.7

dev_dependencies:
  flutter_test:
    sdk: flutter

将 cloud_firestore: ^0.13.7 添加到依赖项。

调试控制台日志

Running pod install...                                            478.2s (!)
CocoaPods' output:
↳
    Invalid plugin specification: DART_DEFINES=flutter.inspector.structuredErrors=true
      Preparing
    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`
    -> Fetching podspec for `cloud_firestore_web` from `.symlinks/plugins/cloud_firestore_web/ios`
    -> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
    -> Fetching podspec for `firebase_core_web` from `.symlinks/plugins/firebase_core_web/ios`
    Resolving dependencies of `Podfile`


    Comparing resolved specification to the sandbox manifest
      A BoringSSL-GRPC
      A Firebase
      A FirebaseAnalytics
      A FirebaseCore
      A FirebaseCoreDiagnostics
      A FirebaseFirestore
      A FirebaseInstallations
      A Flutter
      A GoogleAppMeasurement
      A GoogleDataTransport
      A GoogleUtilities
      A PromisesObjC
      A abseil
      A cloud_firestore
      A cloud_firestore_web
      A firebase_core
      A firebase_core_web
      A gRPC-C++
      A gRPC-Core
      A leveldb-library
      A nanopb
    Downloading dependencies
    

    [!] Error installing gRPC-Core
    [!] /usr/local/bin/git -C /var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v submodule update --init --recursive
    Submodule path 'third_party/abseil-cpp': checked out 'b832dce8489ef7b6231384909fd9b68d5a5ff2b7'
    Submodule path 'third_party/benchmark': checked out '090faecb454fbd6e6e17a75ef8146acb037118d4'
    Submodule path 'third_party/bloaty': checked out '73594cde8c9a52a102c4341c244c833aa61b9c06'
    Submodule path 'third_party/boringssl-with-bazel': checked out '1c2769383f027befac5b75b6cedd25daf3bf4dcf'
    Submodule path 'third_party/cares/cares': checked out 'e982924acee7f7313b4baa4ee5ec000c5e373c30'
    Submodule path 'third_party/envoy-api': checked out '0487bbb43c3e8b54c7332f74ba7344d8265774f7'
    Submodule path 'third_party/gflags': checked out '28f50e0fed19872e0fd50dd23ce2ee8cd759338e'
    Submodule path 'third_party/gflags/doc': checked out '8411df715cf522606e3b1aca386ddfc0b63d34b4'
    Submodule path 'third_party/googleapis': checked out '80ed4d0bbf65d57cc267dfc63bd2584557f11f9b'
    Submodule path 'third_party/googletest': checked out 'c9ccac7cb7345901884aabf5d1a786cfa6e2f397'
    Submodule path 'third_party/libuv': checked out '15ae750151ac9341e5945eb38f8982d59fb99201'
    Submodule path 'third_party/protobuf': checked out 'fe1790ca0df67173702f70d5646b82f48f412b99'
    Submodule path 'third_party/protobuf/third_party/benchmark': checked out '5b7683f49e1e9223cf9927b24f6fd3d6bd82e3f8'
    Submodule path 'third_party/protobuf/third_party/googletest': checked out '5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081'
    Submodule path 'third_party/protoc-gen-validate': checked out 'c0a080f4bea50bc087cdd8551143ee538cf3459e'
    Submodule path 'third_party/udpa': checked out 'db4b343e48c1264bb4d9ff491b059300701dc7c7'
    Submodule path 'third_party/zlib': checked out 'cacf7f1d4e3d44d871b605da3b647f07d718623f'
    Submodule 'third_party/abseil-cpp' (https://github.com/abseil/abseil-cpp.git) registered for path 'third_party/abseil-cpp'
    Submodule 'third_party/benchmark' (https://github.com/google/benchmark) registered for path 'third_party/benchmark'
    Submodule 'third_party/bloaty' (https://github.com/google/bloaty.git) registered for path 'third_party/bloaty'
    Submodule 'third_party/boringssl-with-bazel' (https://github.com/google/boringssl.git) registered for path 'third_party/boringssl-with-bazel'
    Submodule 'third_party/cares/cares' (https://github.com/c-ares/c-ares.git) registered for path 'third_party/cares/cares'
    Submodule 'third_party/envoy-api' (https://github.com/envoyproxy/data-plane-api.git) registered for path 'third_party/envoy-api'
    Submodule 'third_party/gflags' (https://github.com/gflags/gflags.git) registered for path 'third_party/gflags'
    Submodule 'third_party/googleapis' (https://github.com/googleapis/googleapis.git) registered for path 'third_party/googleapis'
    Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/googletest'
    Submodule 'third_party/libuv' (https://github.com/libuv/libuv.git) registered for path 'third_party/libuv'
    Submodule 'third_party/protobuf' (https://github.com/google/protobuf.git) registered for path 'third_party/protobuf'
    Submodule 'third_party/protoc-gen-validate' (https://github.com/envoyproxy/protoc-gen-validate.git) registered for path 'third_party/protoc-gen-validate'
    Submodule 'third_party/udpa' (https://github.com/cncf/udpa.git) registered for path 'third_party/udpa'
    Submodule 'third_party/zlib' (https://github.com/madler/zlib) registered for path 'third_party/zlib'
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/abseil-cpp'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/benchmark'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/bloaty'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/boringssl-with-bazel'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/cares/cares'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/envoy-api'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/gflags'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/googleapis'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/googletest'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/libuv'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/protobuf'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/protoc-gen-validate'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/udpa'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/zlib'...
    Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/bloaty/third_party/googletest'
    Submodule 'third_party/libFuzzer' (https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer) registered for path 'third_party/bloaty/third_party/libFuzzer'
    Submodule 'third_party/re2' (https://github.com/google/re2) registered for path 'third_party/bloaty/third_party/re2'
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/bloaty/third_party/googletest'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/bloaty/third_party/libFuzzer'...
    fatal: unable to access 'https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer/': Failed to connect to chromium.googlesource.com port 443: Operation timed out
    fatal: clone of 'https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer' into submodule path '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/bloaty/third_party/libFuzzer' failed
    Failed to clone 'third_party/libFuzzer'. Retry scheduled
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/bloaty/third_party/re2'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/bloaty/third_party/libFuzzer'...
    fatal: unable to access 'https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer/': Failed to connect to chromium.googlesource.com port 443: Operation timed out
    fatal: clone of 'https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer' into submodule path '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/bloaty/third_party/libFuzzer' failed
    Failed to clone 'third_party/libFuzzer' a second time, aborting
    Submodule 'doc' (https://github.com/gflags/gflags.git) registered for path 'third_party/gflags/doc'
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/gflags/doc'...
    Submodule 'third_party/benchmark' (https://github.com/google/benchmark.git) registered for path 'third_party/protobuf/third_party/benchmark'
    Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/protobuf/third_party/googletest'
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/protobuf/third_party/benchmark'...
    Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/protobuf/third_party/googletest'...
    Failed to recurse into submodule path 'third_party/bloaty'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader.rb:142:in `rescue in execute_command'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader.rb:139:in `execute_command'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-downloader-1.4.0/lib/cocoapods-downloader/base.rb:166:in `block in executable'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-downloader-1.4.0/lib/cocoapods-downloader/git.rb:153:in `target_git'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-downloader-1.4.0/lib/cocoapods-downloader/git.rb:114:in `update_submodules'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-downloader-1.4.0/lib/cocoapods-downloader/git.rb:101:in `block in clone'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader.rb:173:in `block in ui_sub_action'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader.rb:172:in `ui_sub_action'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-downloader-1.4.0/lib/cocoapods-downloader/git.rb:98:in `clone'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-downloader-1.4.0/lib/cocoapods-downloader/git.rb:66:in `download!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-downloader-1.4.0/lib/cocoapods-downloader/base.rb:82:in `block in download'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader.rb:157:in `block in ui_action'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader.rb:156:in `ui_action'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-downloader-1.4.0/lib/cocoapods-downloader/base.rb:80:in `download'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader.rb:108:in `download_source'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader.rb:75:in `download_request'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader/cache.rb:171:in `download'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader/cache.rb:154:in `block in uncached_pod'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader/cache.rb:181:in `in_tmpdir'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader/cache.rb:153:in `uncached_pod'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader/cache.rb:33:in `download_pod'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/downloader.rb:42:in `download'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/installer/pod_source_installer.rb:118:in `download_source'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/installer/pod_source_installer.rb:69:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/installer.rb:561:in `install_source_of_pod'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/installer.rb:512:in `block (2 levels) in install_pod_sources'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/user_interface.rb:86:in `titled_section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/installer.rb:511:in `block in install_pod_sources'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/installer.rb:494:in `each'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/installer.rb:494:in `install_pod_sources'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/installer.rb:253:in `block in download_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/installer.rb:252:in `download_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/installer.rb:161:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/command/install.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.1/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'
Error output from CocoaPods:
↳
         Cloning into '/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v'...
         Note: checking out 'e122aae3cecae0e6be11b62fbe81eda55e662a02'.
         You are in 'detached HEAD' state. You can look around, make experimental
         changes and commit them, and you can discard any commits you make in this
         state without impacting any branches by performing another checkout.
         If you want to create a new branch to retain commits you create, you may
         do so (now or later) by using -b with the checkout command again. Example:
         
         Submodule 'third_party/re2' (https://github.com/google/re2) registered for path 'third_party/bloaty/third_party/re2'
         Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/bloaty/third_party/googletest'...
         Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/bloaty/third_party/libFuzzer'...
         fatal: unable to access 'https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer/': Failed to connect to chromium.googlesource.com port 443: Operation timed out
         fatal: clone of 'https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer' into submodule path '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/bloaty/third_party/libFuzzer' failed
         Failed to clone 'third_party/libFuzzer'. Retry scheduled
         Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/bloaty/third_party/re2'...
         Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/bloaty/third_party/libFuzzer'...
         fatal: unable to access 'https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer/': Failed to connect to chromium.googlesource.com port 443: Operation timed out
         fatal: clone of 'https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer' into submodule path '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/bloaty/third_party/libFuzzer' failed
         Failed to clone 'third_party/libFuzzer' a second time, aborting
         Submodule 'doc' (https://github.com/gflags/gflags.git) registered for path 'third_party/gflags/doc'
         Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/gflags/doc'...
         Submodule 'third_party/benchmark' (https://github.com/google/benchmark.git) registered for path 'third_party/protobuf/third_party/benchmark'
         Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/protobuf/third_party/googletest'
         Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/protobuf/third_party/benchmark'...
         Cloning into '/private/var/folders/wc/4m_4_wzs56v5z7g3z35vylxw0000gn/T/d20200725-9607-d8qy8v/third_party/protobuf/third_party/googletest'...
         Failed to recurse into submodule path 'third_party/bloaty'
    [!] Automatically assigning platform `iOS` with version `8.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 11 Pro.
Exited (sigterm)

颤振医生 -v 结果

[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.4 19E287, locale en-ZM)
    • Flutter version 1.17.5 at /Users/Silokas_Mac/Developer/flutter
    • Framework revision 8af6b2f038 (4 weeks ago), 2020-06-30 12:53:55 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/Silokas_Mac/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
    • Xcode at /Applications/Xcode-beta.app/Contents/Developer
    • Xcode 11.6, Build version 11N700h
    • CocoaPods version 1.10.0.beta.1

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 47.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (2 available)
    • sdk gphone x86 • emulator-5554                        • android-x86 • Android
      10 (API 29) (emulator)
    • iPhone 11 Pro  • 659FF369-2ED5-4E0D-B5F8-3D19BE86B98F • ios         •
      com.apple.CoreSimulator.SimRuntime.iOS-13-6 (simulator)

• No issues found! ```

**Pod file**

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

# 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
  generated_key_values = {}
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) do |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)
      generated_key_values[podname] = podpath
    else
      puts "Invalid plugin specification: #{line}"
    end
  end
  generated_key_values
end

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  # Flutter Pod

  copied_flutter_dir = File.join(__dir__, 'Flutter')
  copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
  copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
  unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
    # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
    # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
    # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.

    generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
    unless File.exist?(generated_xcode_build_settings_path)
      raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
    end
    generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
    cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];

    unless File.exist?(copied_framework_path)
      FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
    end
    unless File.exist?(copied_podspec_path)
      FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
    end
  end

  # Keep pod path relative so it can be checked into Podfile.lock.
  pod 'Flutter', :path => 'Flutter'

  # Plugin Pods

  # 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')
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.each do |name, path|
    symlink = File.join('.symlinks', 'plugins', name)
    File.symlink(path, symlink)
    pod name, :path => File.join(symlink, 'ios')
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENA`enter code here`BLE_BITCODE'] = 'NO'
    end
  end
end

标签: firebasefluttergoogle-cloud-firestore

解决方案


要使用任何 flutterfire 插件,也必须包含它firebase_core。添加

firebase_core: ^0.4.5

到您的依赖项。或者在pub.dev上找到最新版本。


推荐阅读