Cannot install Support repository and sync project in Android Studio

Previously the Android Support Library dependencies were downloaded from Android SDK Manager.

Now all the new versions are available from Google's Maven repository. In future all android libraries will be distributed through maven.google.com

So, by adding the below code to the repositories will build the project.

repositories {
    maven {
        url "https://maven.google.com"
    }
}

I had to add the following to my project level build.gradle. Then the button to install and worked.

allprojects {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
}