Could not find the firebase_core FlutterFire plugin error displayed when building Flutter project

2,277

Add firebase_core to your project.

Share:
2,277
laxsore
Author by

laxsore

Updated on December 02, 2022

Comments

  • laxsore
    laxsore over 1 year

    I got following error when building flutter project: *A problem occurred evaluating project ':firebase_ml_vision'.

    Could not find the firebase_core FlutterFire plugin, have you added it as a dependency in your pubspec*

    Does it mean that I have to install some additional libraries? I just want to use ML Vision in my project. Thank you for any help.

    My pubspec.yaml file:

    dependencies:
      flutter:
        sdk: flutter
      get: ^3.24.0
    
      firebase_ml_vision: ^0.11.0
      image_picker: ^0.6.3+4
      image_cropper: 1.0.2
    

    build.gradle (app):

    def localProperties = new Properties()
    def localPropertiesFile = rootProject.file('local.properties')
    if (localPropertiesFile.exists()) {
        localPropertiesFile.withReader('UTF-8') { reader ->
            localProperties.load(reader)
        }
    }
    
    def flutterRoot = localProperties.getProperty('flutter.sdk')
    if (flutterRoot == null) {
        throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
    }
    
    def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
    if (flutterVersionCode == null) {
        flutterVersionCode = '1'
    }
    
    def flutterVersionName = localProperties.getProperty('flutter.versionName')
    if (flutterVersionName == null) {
        flutterVersionName = '1.0'
    }
    
    apply plugin: 'com.android.application'
    apply plugin: 'com.google.gms.google-services'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
    
    android {
        compileSdkVersion 30
    
        defaultConfig {
            // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
            applicationId "com.example.grobonet"
            minSdkVersion 16
            targetSdkVersion 30
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
        }
    
        buildTypes {
            release {
                // TODO: Add your own signing config for the release build.
                // Signing with the debug keys for now, so `flutter run --release` works.
                signingConfig signingConfigs.debug
            }
        }
    }
    
    flutter {
        source '../..'
    }
    
    

    build.gradle (project)

    buildscript {
        repositories {
            google()
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:4.1.3'
            classpath 'com.google.gms:google-services:4.3.5'
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    rootProject.buildDir = '../build'
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
    }
    subprojects {
        project.evaluationDependsOn(':app')
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }