US Office

1176 Shadeville Rd, Crawfordville Florida 32327, USA

 +1 (850) 780-1313

India Office

Office No. 501, Shree Ugati Corporate Park, Gandhinagar - 382421, Gujarat, India

[email protected]

How to Solve firebase_core_web not found In Flutter??

How to Solve firebase_core_web not found in Flutter

How to Solve firebase_core_web not found In Flutter??

Earlier we have been through Step By Step Guide to How to Integrate Firebase In Flutter Mobile Application. So in this article, we will go through How to Solve firebase_core_web not found In Flutter??

How to Solve firebase_core_web not found in Flutter??

When the user tries to connect the Flutter Project to Firebase via pubspec.yaml

firebase_auth: ^0.16.0
cloud_firestore: ^0.13.5

When a user runs a Gradle file sometimes it throws an error.

In your android/app/build.gradle, update the following:

android {
    // ...
    defaultConfig {
        // ...
        minSdkVersion 16
    }
}

into:

android {
    // ...
    defaultConfig {
        // ...
        minSdkVersion 23
    }
}

Note: You need to use minSdkVersion 23 when using firebase in a flutter.

To change the minimum target SDK version:

  • Open android/app/build.gradle, then find the line that says minSdkVersion 16.
  • Change that line to minSdkVersion 21.
  • Save the file.

The settings.gradle file is provided to you when you create any new flutter project. For reference, this is how your settings.gradle file should be:

include ':app'

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()

def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
    pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}

plugins.each { name, path ->
    def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
    include ":$name"
    project(":$name").projectDir = pluginDirectory
}

Explanation of Settings.Gradle:

Gradle is a build tool used for android projects, just like ant or maven, it uses groovy language or kotlin for scripting. In this case, the above code is written using groovy and since groovy is a JVM language then it is able to use Java libraries. So basically include ‘: app‘ will add the project to the build.

This line:

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()

is getting the path to the flutter project that you created in your machine.

Change file settings.gradle to this

include ':app'

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()

def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
    pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}

plugins.each { name, path ->
    def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
    include ":$name"
    project(":$name").projectDir = pluginDirectory
}

Please add this in flutter app -> android -> settings.gradle

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()

    def plugins = new Properties()

    def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
    if (pluginsFile.exists()) {

        pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
    }

    plugins.each { name, path ->
        def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
        include ":$name"
        project(":$name").projectDir = pluginDirectory
    }

We will get output like below

Firebase_core_web

Firebase_core_web

Conclusion:

In this article, we have been through How to Solve firebase_core_web not found in Flutter??

Keep Learning !!! Keep Fluttering !!!

Still, Need a Support for Flutter Development?

FlutterAgency.com is our portal Platform dedicated to Flutter Technology and Flutter Developers. The portal is full of cool resources from Flutter like Flutter Widget GuideFlutter ProjectsCode libs and etc.

FlutterAgency.com is one of the most popular online portal dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge on Flutter.

Post a Comment