gradle fails on using flutter in Android Studio

Have you tried adding the google maven repository to your project level build.gradle file?

buildscript {
repositories {
    google()
    jcenter()
    maven {
        url "https://maven.google.com"
    }
}

either the buildscript section or the allprojects section.


When i got this same problem, the only way that i can find to solution it was update gradle versions:

in android/gradle/wrapper/gradle-wrapper.properties

to distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip

and

in android/build.gradle

to dependencies { classpath 'com.android.tools.build:gradle:3.5.3' classpath 'com.google.gms:google-services:4.3.2'

and in android/build.gradle yet

buildscript {
    ext.kotlin_version = '1.3.61'

in pubspec.yaml

firebase_core: ^0.4.2+1 
  cloud_firestore: ^0.12.11

I hope that it can help you.