Add maven { url 'https://maven.google.com' } before jcenter() in
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
}
it will work
Update :
Note : google() and maven { url 'https://maven.google.com' } are pointing to the same repo, google() is a Google's Maven repo shortcut. You can add google() instead of maven { url 'https://maven.google.com' } IF you are using :
Gradle >= v.4.x+
Android Studio >= 3.x+
Gradle plugin for Android >= 3.x+