firebase_crashlytics 已解析为 2.2.1,这取决于 Firebase/Crashlytics (= 8.6.0)

Posted

技术标签:

【中文标题】firebase_crashlytics 已解析为 2.2.1,这取决于 Firebase/Crashlytics (= 8.6.0)【英文标题】:firebase_crashlytics was resolved to 2.2.1, which depends on Firebase/Crashlytics (= 8.6.0) 【发布时间】:2021-11-03 11:37:52 【问题描述】:

我在尝试使用 crashlytics 构建 Flutter 应用时遇到错误 (但不知何故在codemagic上成功构建) 我做了

关注official steps 尝试使用这个fix 没有成功

这些是我的日志


╰─$ flutter run
Running "flutter pub get" in <my app>_time_reporting...               804ms
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running pod install...                                           1,179ms
CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

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

    Finding Podfile changes
      - Flutter
      - connectivity_plus
      - device_info
      - firebase_core
      - firebase_crashlytics
      - flutter_barcode_scanner
      - image_picker
      - package_info
      - path_provider

    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `connectivity_plus` from `.symlinks/plugins/connectivity_plus/ios`
    -> Fetching podspec for `device_info` from `.symlinks/plugins/device_info/ios`
    -> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
    firebase_core: Using Firebase SDK version '8.6.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_crashlytics` from `.symlinks/plugins/firebase_crashlytics/ios`
    firebase_crashlytics: Using Firebase SDK version '8.6.0' defined in 'firebase_core'
    -> Fetching podspec for `flutter_barcode_scanner` from `.symlinks/plugins/flutter_barcode_scanner/ios`
    -> Fetching podspec for `image_picker` from `.symlinks/plugins/image_picker/ios`
    -> Fetching podspec for `package_info` from `.symlinks/plugins/package_info/ios`
    -> Fetching podspec for `path_provider` from `.symlinks/plugins/path_provider/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_c_7_9.txt exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/c/7/9/Reachability/3.2/Reachability.podspec.json 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/8.5.0/Firebase.podspec.json exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/0/3/5/Firebase/8.3.0/Firebase.podspec.json exists! Returning local because checking is only perfomed in repo update
    [!] CocoaPods could not find compatible versions for pod "Firebase/Crashlytics":
      In snapshot (Podfile.lock):
        Firebase/Crashlytics (= 8.3.0)

      In Podfile:
        firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`) was resolved to 2.2.1, which depends on
          Firebase/Crashlytics (= 8.6.0)

    Specs satisfying the `Firebase/Crashlytics (= 8.3.0), Firebase/Crashlytics (= 8.6.0)` dependency were found, but they required a higher minimum deployment target.

    /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.10.2/lib/cocoapods/resolver.rb:94:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.2/lib/cocoapods/installer/analyzer.rb:1074:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.2/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.2/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.2/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.2/lib/cocoapods/installer.rb:414:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.2/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.2/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.2/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.2/lib/cocoapods/installer.rb:160:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.2/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.2/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.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:
↳

    [!] Smart quotes were detected and ignored in your Podfile. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.

Error running pod install
Error launching application on iPhone 12 Pro Max.

这是我的 podfile
# Uncomment this line to define a global platform for your project
platform :ios, '12.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 flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#generated_xcode_build_settings_path must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #generated_xcode_build_settings_path. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  # https://***.com/a/69047809/16087862
  pod 'Firebase/Core'
  pod 'Firebase/Crashlytics'
end

# or pod ‘Firebase/AnalyticsWithoutAdIdSupport’
# for Analytics without IDFA collection capability

# add pods for any other desired Firebase products
# https://firebase.google.com/docs/ios/setup#available-pods

post_install do |installer|
  installer.pods_project.targets.each do |target|
    #target.build_configurations.each do |config|
    #  config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    #end
    flutter_additional_ios_build_settings(target)
    # https://***.com/a/69047809/16087862
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
    end
  end
end

这是我的 pubspec.yaml

environment:
  sdk: '>=2.13.0 <3.0.0'

dependencies:
  flutter:
    sdk: flutter
  beamer: ^0.14.1
  connectivity_plus: ^1.1.0
  device_info: ^2.0.2
  firebase_core: ^1.6.0
  firebase_crashlytics: ^2.2.1
  flutter_barcode_scanner: ^2.0.0
  flutter_hooks: ^0.17.0
  google_fonts: ^2.1.0
  hooks_riverpod: ^0.14.0
  http: ^0.13.3
  image_picker: ^0.8.3
  intl: ^0.17.0
  package_info: ^2.0.2
  shimmer: ^2.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  stub: ^0.3.0  
  flutter_native_splash: ^1.2.1
  flutter_launcher_icons: ^0.9.2

flutter_icons:
  android: true
  ios: true
  image_path: images/icon.png

flutter_native_splash:
  color: '#ECEFF1'
  image: images/splash.png
  android: true
  ios: true
  web: true

flutter:
  uses-material-design: true
  assets:
    - images/english.png
    - images/splash.png

我的颤振医生-v
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.2 20G95 darwin-x64, locale en-EE)
    • Flutter version 2.2.3 at /Users/francesco/fvm/versions/stable
    • Framework revision f4abaa0735 (10 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/francesco/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      ???? https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      ???? https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] VS Code (version 1.60.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.26.0

[✓] Connected device (3 available)
    • iPhone 12 Pro Max (mobile) • 7D1B0B46-6D39-40A9-8792-8853C86AB930 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)            • macos                                • darwin-x64     • macOS 11.5.2 20G95 darwin-x64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 93.0.4577.63

! Doctor found issues in 1 category.

我已尝试查看其他建议的解决方案, 但我看到大多数情况下建议升级 ios 版本 (我已经这样做了)

有什么建议吗?

【问题讨论】:

【参考方案1】:
rm pubspec.lock && \                                                                                                                                                                                                                  
flutter clean && \
cd ios && \
pod cache clean --all && \
cd .. && \
flutter pub get && \
cd ios && \
pod update && \
cd ..

然后flutter run

解决问题

【讨论】:

以上是关于firebase_crashlytics 已解析为 2.2.1,这取决于 Firebase/Crashlytics (= 8.6.0)的主要内容,如果未能解决你的问题,请参考以下文章

找不到文件 Flutter/Flutter.h

Flutter 构建失败 'UserAgent.h' 文件未找到

合并后如何自动将文件解析为已解析

将响应转换为字典时,已解析响应的顺序已更改

“预览”无法解析为类型,导入已定义[关闭]

解析标记为已发送但在设备上看不到的 android 推送通知