pubspec.lock 中的依赖项解析为版本 2.9.0,但我们希望使用版本 2.7.1

Ban*_*ram 5 android firebase crashlytics flutter

我们正在尝试将 Firebase_crashlytics 集成到我们的应用程序中,但由于我们的应用程序是基于旧版本的 Flutter 构建的(它不支持 Null Safety),因此我们无法使用最新版本。然后我们决定集成 2.7.1 或更低版本,但 pubspec.lock 文件始终将版本解析为 2.9.0,这是 null 安全的,并且它会因我们的应用程序不是 null 安全而引发构建错误。

\n

有人可以指导我在这方面应该做什么或不做什么吗?

\n

这是我们的 Pubspec.yaml,

\n
name: ------\ndescription: A new Flutter application.\n\n# The following line prevents the package from being accidentally published to\n# pub.dev using `pub publish`. This is preferred for private packages.\npublish_to: 'none' # Remove this line if you wish to publish to pub.dev\n\n# The following defines the version and build number for your application.\n# A version number is three numbers separated by dots, like 1.2.43\n# followed by an optional build number separated by a +.\n# Both the version and the builder number may be overridden in flutter\n# build by specifying --build-name and --build-number, respectively.\n# In Android, build-name is used as versionName while build-number used as versionCode.\n# Read more about Android versioning at https://developer.android.com/studio/publish/versioning\n# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.\n# Read more about iOS versioning at\n\n# ios\nversion: 0.1.1+1\n\n# android\n#version: 0.1.1+1\n\nenvironment:\n  sdk: ">=2.7.0 <3.0.0"\n\ndependency_overrides:\n  firebase_core_platform_interface: 4.2.0\n\ndependencies:\n  flutter:\n    sdk: flutter\n#  braintree_device_data:\n#    path: ../braintree_device_data\n  flutter_braintree:\n    path: ./flutter-braintree-master\n  onesignal_flutter:\n    path: ./flutter-onesignal\n#  flutter_facebook_auth:\n#    git:\n#      url: https://github.com/darwin-morocho/flutter-facebook-auth.git\n#      ref: master\n#      path: facebook_auth/\n\n\n  # The following adds the Cupertino Icons font to your application.\n  # Use with the CupertinoIcons class for iOS style icons.\n  cupertino_icons: ^1.0.2\n  get: ^4.1.2\n  carousel_slider: ^3.0.0\n  email_validator: ^2.0.1\n  tab_indicator_styler: ^1.0.0\n  flutter_rating_bar:\n  flutter_staggered_grid_view: ^0.3.4\n  dotted_border: ^2.0.0\n  http: ^0.13.1\n  shimmer: ^2.0.0\n  flutter_slidable: ^0.6.0\n  google_sign_in: ^5.0.3\n#  flutter_facebook_auth: ^3.5.2 #// used as old facebook auth but due to an update we cant use it anymore\n#  flutter_facebook_auth: ^4.4.1+1 #// use this if you're using mac with an intel chip or the team is big\n  flutter_facebook_auth: ^5.0.7\n  sign_in_with_apple: ^3.2.0\n  sqflite: ^2.0.0+3\n  google_place: ^0.4.0\n  shared_preferences: ^2.0.6\n  nuts_activity_indicator: ^0.1.1\n  graphql_flutter: ^5.0.0\n#  flutter_braintree: ^2.0.0\n  flutter_html: ^2.2.1\n  equatable: ^2.0.3\n  pull_to_refresh: ^2.0.0\n  badges: ^2.0.1\n  image_picker: ^0.8.4+1\n#  image_picker: ^0.8.6 // requires gradle to be updated to 7.2 which may break some packages and gradle 7.2 doesn't work with OneSignal\n  firebase_core: ^1.6.0\n  firebase_analytics: ^8.3.3\n  firebase_performance: ^0.6.0+2\n#  firebase_performance: ^0.8.3+3\n#  url_launcher: ^6.0.10\n#  url_launcher: ^6.1.7\n  url_launcher: ^6.1.5\n  dio: ^4.0.0\n  flutter_svg: ^0.22.0\n  syncfusion_flutter_datepicker: ^19.3.45\n  flutter_typeahead: ^3.2.1\n  lottie: ^1.2.1\n  google_fonts: ^2.1.0\n  flutter_screenutil: ^5.0.0+2\n  app_tracking_transparency: ^2.0.2+1\n  #  new_version: ^0.3.1\n  new_version_plus: ^0.0.1+4\n  uni_links: ^0.5.1\n  #  app_links: ^2.2.0\n  app_links: ^3.4.1\n  flutter_phoenix: ^1.0.0\n  device_info_plus: ^4.0.0\n  path_provider: ^2.0.11\n  permission_handler: ^10.0.0\n  pusher_channels_flutter: ^2.0.1\n  intl: ^0.17.0\n  social_share: ^2.2.1\n  share_plus: ^4.5.3\n  upgrader: ^4.7.0\n  photo_view: ^0.14.0\n  file_picker: ^4.6.1\n  flutter_native_splash:\n  multi_image_picker2: ^5.0.2\n#  firebase_crashlytics: ^2.5.2\n#  cloudflare: ^1.3.0+11\n\ndev_dependencies:\n  flutter_test:\n    sdk: flutter\n  flutter_launcher_icons:\n\nflutter_native_splash:\n  color: "#ffffff"\n  image: assets/images/logo.png\n\nflutter_icons:\n  android: true\n  ios: true\n  image_path: "assets/images/launcher_icon.png"\n\n# For information on the generic Dart part of this file, see the\n# following page: https://dart.dev/tools/pub/pubspec\n\n# The following section is specific to Flutter.\nflutter:\n\n  # The following line ensures that the Material Icons font is\n  # included with your application, so that you can use the icons in\n  # the material Icons class.\n  uses-material-design: true\n\n  # To add assets to your application, add an assets section, like this:\n  assets:\n    - assets/images/\n    - assets/JSON/\n    - assets/JSON/No_Message/\n  #   - images/a_dot_ham.jpeg\n\n  # An image asset can refer to one or more resolution-specific "variants", see\n  # https://flutter.dev/assets-and-images/#resolution-aware.\n\n  # For details regarding adding assets from package dependencies, see\n  # https://flutter.dev/assets-and-images/#from-packages\n\n  # To add custom fonts to your application, add a fonts section here,\n  # in this "flutter" section. Each entry in this list should have a\n  # "family" key with the font family name, and a "fonts" key with a\n  # list giving the asset and other descriptors for the font. For\n  # example:\n  fonts:\n    - family: Mulish\n      fonts:\n        - asset: assets/fonts/Mulish-Regular.ttf\n          weight: 400\n  #       - asset: fonts/TrajanPro_Bold.ttf\n  #         weight: 700\n  #\n  # For details regarding fonts from package dependencies,\n  # see https://flutter.dev/custom-fonts/#from-packages\n
Run Code Online (Sandbox Code Playgroud)\n

这是Flutter doctor -v的结果,

\n
MacBooks-MacBook-Pro:marketplace-mobile-app macbookpro$ flutter doctor -v\n[\xe2\x9c\x93] Flutter (Channel stable, 2.10.4, on macOS 12.6.3 21G419 darwin-x64, locale en-PK)\n    \xe2\x80\xa2 Flutter version 2.10.4 at /Users/macbookpro/src/flutter\n    \xe2\x80\xa2 Upstream repository https://github.com/flutter/flutter.git\n    \xe2\x80\xa2 Framework revision c860cba910 (11 months ago), 2022-03-25 00:23:12 -0500\n    \xe2\x80\xa2 Engine revision 57d3bac3dd\n    \xe2\x80\xa2 Dart version 2.16.2\n    \xe2\x80\xa2 DevTools version 2.9.2\n\n[\xe2\x9c\x93] Android toolchain - develop for Android devices (Android SDK version 33.0.0)\n    \xe2\x80\xa2 Android SDK at /Users/macbookpro/Library/Android/sdk\n    \xe2\x80\xa2 Platform android-33, build-tools 33.0.0\n    \xe2\x80\xa2 ANDROID_HOME = /Users/macbookpro/Library/Android/sdk\n    \xe2\x80\xa2 Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java\n    \xe2\x80\xa2 Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)\n    \xe2\x80\xa2 All Android licenses accepted.\n\n[\xe2\x9c\x93] Xcode - develop for iOS and macOS (Xcode 14.2)\n    \xe2\x80\xa2 Xcode at /Applications/Xcode.app/Contents/Developer\n    \xe2\x80\xa2 CocoaPods version 1.10.2\n\n[\xe2\x9c\x93] Chrome - develop for the web\n    \xe2\x80\xa2 Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome\n\n[\xe2\x9c\x93] Android Studio (version 2021.2)\n    \xe2\x80\xa2 Android Studio at /Applications/Android Studio.app/Contents\n    \xe2\x80\xa2 Flutter plugin can be installed from:\n       https://plugins.jetbrains.com/plugin/9212-flutter\n    \xe2\x80\xa2 Dart plugin can be installed from:\n       https://plugins.jetbrains.com/plugin/6351-dart\n    \xe2\x80\xa2 Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)\n\n[\xe2\x9c\x93] Connected device (2 available)\n    \xe2\x80\xa2 Infinix X6811 (mobile) \xe2\x80\xa2 07363251BU000513 \xe2\x80\xa2 android-arm64  \xe2\x80\xa2 Android 11 (API 30)\n    \xe2\x80\xa2 Chrome (web)           \xe2\x80\xa2 chrome           \xe2\x80\xa2 web-javascript \xe2\x80\xa2 Google Chrome 109.0.5414.119\n\n[\xe2\x9c\x93] HTTP Host Availability\n    \xe2\x80\xa2 All required HTTP hosts are available\n\n\xe2\x80\xa2 No issues found!\n
Run Code Online (Sandbox Code Playgroud)\n

Ban*_*ram 2

好的,一点更新..问题已解决。

我们做了什么:

  • flutter pub缓存修复
  • 扑干净
  • 扑扑酒吧得到
  • 使缓存无效并重新启动 (Android Studio)

昨天它不起作用,但今天我们重新启动 Mac 并运行它起作用的相同命令时,不知何故。