如何将 Firebase Crashlytics 添加到 flutter 应用程序?

How to add Firebase Crashlytics to flutter app?

我想将 Firebase Crashlytics 添加到我的 flutter 应用中。我已经完成了以下步骤:https://firebase.flutter.dev/docs/crashlytics/overview#installation。 当 运行ning "flutter 运行" 我得到以下输出:

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

Finding Podfile changes
  A firebase_crashlytics
  - Flutter
  - cloud_firestore
  - firebase_auth
  - firebase_core
  - firebase_storage
  - image_cropper
  - image_picker
  - path_provider
  - share
  - shared_preferences

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 '6.26.0' defined in 'firebase_core'
-> Fetching podspec for `firebase_auth` from `.symlinks/plugins/firebase_auth/ios`
firebase_auth: Using Firebase SDK version '6.26.0' defined in 'firebase_core'
-> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
firebase_core: Using Firebase SDK version '6.26.0' defined in 'firebase_core'
-> Fetching podspec for `firebase_crashlytics` from `.symlinks/plugins/firebase_crashlytics/ios`
firebase_crashlytics: Using Firebase SDK version '6.26.0' defined in 'firebase_core'
-> Fetching podspec for `firebase_storage` from `.symlinks/plugins/firebase_storage/ios`
firebase_storage: Using Firebase SDK version '6.26.0' defined in 'firebase_core'
-> Fetching podspec for `image_cropper` from `.symlinks/plugins/image_cropper/ios`
-> Fetching podspec for `image_picker` from `.symlinks/plugins/image_picker/ios`
-> Fetching podspec for `path_provider` from `.symlinks/plugins/path_provider/ios`
-> Fetching podspec for `share` from `.symlinks/plugins/share/ios`
-> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`

Resolving dependencies of `Podfile`
  CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_0_3_5.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/3/5/Firebase/6.34.0/Firebase.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/3/5/Firebase/6.26.0/Firebase.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/3/5/Firebase/6.26.0/Firebase.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/3/5/Firebase/6.26.0/Firebase.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/3/5/Firebase/6.26.0/Firebase.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_3_7_4.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/3/7/4/TOCropViewController/2.5.5/TOCropViewController.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/3/5/Firebase/6.26.0/Firebase.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/3/5/Firebase/6.26.0/Firebase.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_6_3_6.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/6/3/6/FirebaseAuth/6.9.2/FirebaseAuth.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_3_c_c.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/3/c/c/FirebaseStorage/3.9.1/FirebaseStorage.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_8_b_d.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/b/d/FirebaseCore/6.10.4/FirebaseCore.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_0_9_f.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/9/f/FirebaseFirestore/1.19.0/FirebaseFirestore.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_e_7_d.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/e/7/d/FirebaseCrashlytics/4.6.2/FirebaseCrashlytics.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/3/7/4/TOCropViewController/2.5.5/TOCropViewController.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/6/3/6/FirebaseAuth/6.5.3/FirebaseAuth.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_4_2_7.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/4/2/7/FirebaseAuthInterop/1.1.0/FirebaseAuthInterop.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_0_8_4.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/8/4/GoogleUtilities/6.7.2/GoogleUtilities.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/8/4/GoogleUtilities/6.7.2/GoogleUtilities.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/8/4/GoogleUtilities/6.7.2/GoogleUtilities.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_c_e_3.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/c/e/3/GTMSessionFetcher/1.4.0/GTMSessionFetcher.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/c/e/3/GTMSessionFetcher/1.4.0/GTMSessionFetcher.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/b/d/FirebaseCore/6.7.2/FirebaseCore.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/8/4/GoogleUtilities/6.7.2/GoogleUtilities.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_8_9_c.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/9/c/FirebaseCoreDiagnosticsInterop/1.2.0/FirebaseCoreDiagnosticsInterop.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_8_3_c.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/3/c/FirebaseCoreDiagnostics/1.7.0/FirebaseCoreDiagnostics.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/b/d/FirebaseCore/6.7.2/FirebaseCore.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/e/7/d/FirebaseCrashlytics/4.1.1/FirebaseCrashlytics.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_2_f_7.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/2/f/7/FirebaseInstallations/1.7.0/FirebaseInstallations.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_6_f_9.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/6/f/9/FirebaseAnalyticsInterop/1.5.0/FirebaseAnalyticsInterop.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_0_b_5.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/b/5/PromisesObjC/1.2.11/PromisesObjC.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_0_6_a.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/6/a/GoogleDataTransport/7.5.1/GoogleDataTransport.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_b_c_f.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/b/c/f/GoogleDataTransportCCTSupport/3.2.0/GoogleDataTransportCCTSupport.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_6_1_e.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/6/1/e/nanopb/2.30906.0/nanopb.podspec.json exists! Returning local because checking is only perfomed in repo update
[!] CocoaPods could not find compatible versions for pod "GoogleDataTransport":
  In snapshot (Podfile.lock):
    GoogleDataTransport (= 7.2.0, ~> 7.0)

  In Podfile:
    firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`) was resolved to 0.2.1-1, which depends on
      Firebase/Crashlytics (~> 6.26.0) was resolved to 6.26.0, which depends on
        FirebaseCrashlytics (~> 4.1.1) was resolved to 4.1.1, which depends on
          GoogleDataTransport (~> 6.1)


You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * changed the constraints of dependency `GoogleDataTransport` inside your development pod `firebase_crashlytics`.
   You should run `pod update GoogleDataTransport` to apply changes you've made.

/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:328:in `raise_error_unless_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:310:in `block in unwind_for_conflict'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `tap'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `unwind_for_conflict'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:257:in `process_topmost_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1065:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1063:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/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.9.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

CocoaPods 的错误输出: ↳

[!] 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: CocoaPods's specs repository is too out-of-date to satisfy dependencies. To update the CocoaPods specs, run: pod repo update

错误运行ning pod install 在 iPhone 11.

上启动应用程序时出错

我也尝试了日志中提到的解决方案,但对我来说没有任何效果。我该怎么做才能解决这个问题?

我的设置:VS Code,Flutter

试试这个:

  1. 转到项目中的 ios/Pods/Local Podspevs 目录
  2. 检查每个 json 文件以找到所需的最高 ios 版本。我的 "ios": "10.0" 其中一些
  3. 返回ios/目录
  4. 打开Podfile文件
  5. 取消注释 # platform :ios, '9.0' 并将 9.0 替换为第 2 步中的版本,例如 10.0
    • # platform :ios, '9.0' > platform :ios, '10.0'
  6. 运行 pod install,错误应该消失了