I had the same problem, I tried Manoj Prabhakar's solution but I fixed adding the google()
repository to the buildscript block in the project level build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}