'React Native: Could not find com.google.android.gms:play-services-iid:20.0.2

I am using firebase for my android app and all of a sudden I am getting an error when I tried running the app with run android. Last week it was working perfectly. I don't know how this error occurred and I have no idea how to solve it or where to start, I've also looked online for hours but have found nothing yet.

dependencies in my build.gradle:

buildscript {
    ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 29
        supportLibVersion = "29.0.0"
        firebaseVersion = "21.1.0"
    }
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.1")
        classpath 'com.google.gms:google-services:4.3.2'
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        maven {
            url "https://jitpack.io"
        }
        // maven {
        //     url "https://mvnrepository.com"
        // }

        google()
        jcenter()
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source