Flutter Dependency Error 'have you added it as a dependency in your pubspec?'

Viewed 514

I'm getting this error when I try to 'flutter run' my project.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\denis\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_admob-0.11.0+1\android\build.gradle' line: 26

* What went wrong:
A problem occurred evaluating root project 'firebase_admob'.
> Could not find the firebase_core FlutterFire plugin, have you added it as a dependency in your pubspec?

* 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 root project 'firebase_admob'.
> compileSdkVersion is not specified.

* 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

My pubspec.yaml already have firebase_admob: ^0.11.0+1. I tried some solutions:

  • Flutter clean
  • Flutter pub get
  • Flutter packages get
  • Flutter upgrade

My app/build.gradle have compileSdkVersion defined minSdkVersion 21 and targetSdkVersion 29

1 Answers

The error says "Could not find the firebase_core FlutterFire plugin". Did you add that one ? It's required to use any other FlutterFire package.

Related