Требуется более новая версия плагина firebase_core FlutterFire, пожалуйста, обновите свою зависимость firebase_core от pubspec

# #firebase #flutter #google-cloud-firestore

Вопрос:

Я получаю эту ошибку при попытке создать проект Flutter в VSCode. Тот же проект работал и раньше, но теперь он перестал работать.

 FAILURE: Build completed with 2 failures.

-----------
* Where:
Build file 'C:FltrDevSoftwareflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.2androidbuild.gradle' line: 28

* What went wrong:
A problem occurred evaluating project ':cloud_firestore'.
> A newer version of the firebase_core FlutterFire plugin is required, please update your firebase_core pubspec dependency.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':cloud_firestore'.
> compileSdkVersion is not specified. Please add it to build.gradle

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 730ms
 

Строка 28 build.gradle помечена .. , это последняя строка здесь:

 def firebaseCoreProject = findProject(':firebase_core')
if (firebaseCoreProject == null) {
    throw new GradleException('Could not find the firebase_core FlutterFire plugin, have you added it as a dependency in your pubspec?')
} else if (!firebaseCoreProject.properties['FirebaseSDKVersion']) {
    **throw new GradleException('A newer version of the firebase_core FlutterFire plugin is required, please update your firebase_core pubspec dependency.')**
}
 

это важная часть моего pubspec.yaml:

 environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2

  package_info_plus: ^1.0.6
  package_info_plus_web: ^1.0.4
  cached_network_image: ^3.1.0
  cloud_firestore: ^2.5.2
  cloud_functions: ^3.0.3
  firebase_auth: ^3.1.1
  firebase_core: ^1.6.0
  firebase_crashlytics: ^2.2.1
  firebase_messaging: ^10.0.7
  flutter_svg: ^0.22.0
  font_awesome_flutter: ^9.1.0
  get: ^4.3.8
  get_storage: ^2.0.3
  google_place: ^0.4.3
  in_app_review: ^2.0.3
  percent_indicator: ^3.0.1
  syncfusion_flutter_sliders: ^19.2.60
  url_launcher: ^6.0.10
  webview_flutter: ^2.0.13

dev_dependencies:
  flutter_test:
    sdk: flutter
 

У кого-нибудь есть идеи, как это решить? Я пробовал разные версии пакетов. Я удалил некоторые папки кэша, как описано в других ссылках переполнения стека. Но решения пока нет.

Ответ №1:

Это сработало с этой командой:

 flutter pub cache repair