Error: could not find com.google.gms:google-services:4.2.0
Solution 1:
Because google-services:4.2.0 is not available at Central Repository, so it needs to be downloaded from Android Tools Repository. To add this to your project add
maven { url 'https://dl.bintray.com/android/android-tools' }
this to buildscript repositories. For more refer to https://mvnrepository.com/artifact/com.google.gms/google-services/4.2.0
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.fabric.io/public'
}
// Add this to your project
maven { url 'https://dl.bintray.com/android/android-tools' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// These docs use an open ended version so that our plugin
// can be updated quickly in response to Android tooling updates
// We recommend changing it to the latest version from our changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.27.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
}
google()
}
}
Solution 2:
Monday December 10 2018, 1:30PM PST
The Google Play services plugin, the Firebase Performance monitoring plug, exoplayer, and possible other dependencies were found to be missing on jCenter. It's not clear why, but some of the teams are known to be moving their build artifacts to the Google maven repo.
As of right now, the Google Play services plugin has been migrated, and should be available through google() in your buildscript for now.