I had the same issue and I was able to resolve it by adding maven { url "https://maven.google.com" } to list of repositories in project level build.gradle as shown below.
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
Also, ensure this apply plugin: 'com.google.gms.google-services' comes after your dependencies to avoid version issues.