I have been trying to switch my project from Intellij to Android Studio, which has required me to create a build.gradle file. I know I can add each of these as a library dep
Just to share infomation, I got same problem and the solution was different.
In my case, proxy server was used and it causes the problem. I needed to configure https proxy settings, as discussed in gradle behind proxy in Android Studio 1.3.