I have already created one project and gradle sync worked successfully.
When I try to create another project it fails and gives the error message that
This fixed it for me:
Open /gradle/wrapper/gradle-wrapper.properties
Change 'https' to 'http' in the distributionUrl:
distributionUrl=http\://services.gradle.org/distributions/gradle-2.1-all.zip
Then you need to sync project with gradle files
Make sure you have specified latest gradle version in build.gradle file and latest distributionUrl in gradle-wrapper.properties file. Check network connetivity is proper or not [ Network connection should be without firewall/other settings which can stop upgrading gradle]
I also faced the same issue and the problem was related to certificates. 1: So first step is go to Build-> Clean Project. It will give you the details about the error. 2: Copy URL which is failing from the stack-trace. For eg build is failed to download some file, stack-trace will have the information of the URL. 3: Open the url in a browser, if you are able to open it that means your proxy settings are fine but java is unable to trust the source to download it. 4: So you need to copy the certificate manually and put in the jre certificates. And rebuild should resolve the problem. 5: Or if you have the latest jre verison, it might solve the problem.
THis fixed it for me after wasting lot of time trying various solutions: Check the dependencies -> classpath in build.gradle file of project
dependencies {
classpath 'com.android.tools.build:gradle:2.10'
}
Changed this to classpath 'com.android.tools.build:gradle:2.0.0-rc1 in my case to fix the issue . To know the correct version to be used, made a new project and checked the build.gradle file . Hope this helps.
I have the same problem and salve it,My conduction is I define the HTTP proxy and I use agent to connect the server. Actually, you don't need proxy to connect jcenter
I closed my studio and when I re-opened the project, I got a window to enter proxy information. In that, I had to check the check box which said "Enable HTTPS proxy" and that worked for me!