2
votes

I'm trying to build my Android App using the Gradle command line interface. I'v also add GRADLE_HOME/bin to the environment. Firstly, i used gradle init to generate the wrapper, gradlew in my project folder. Now, when i use this wrapper to build my app(./gradlew build) or use any of its functionality, it tries to download a gradle-2.3.zip file and fails at it(error message below). What I don't understand is why gradle try to download gradle again. Also, when I open the download url in my browser, it says that the page is insecure, which might be the cause of the error. What am I doing wrong? Is there a workaround? I have managed to download the zip file using my browser, but I don't know what to do with it. Here is the exception I got.

Downloading https://services.gradle.org/distributions/gradle-2.3-bin.zip

Exception in thread "main" javax.net.ssl.SSLHandshakeException:

java.security.cert.CertificateException: No subject alternative DNS name matching services.gradle.org found. at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1884) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1439) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:209) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:878) at sun.security.ssl.Handshaker.process_record(Handshaker.java:814) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1016) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323) at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)

2
Here is same problem...stackoverflow.com/questions/29576097/…Shvet

2 Answers

10
votes

Just update gradle/wrapper/gradle-wrapper.properties

update this:

-from:

distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-all.zip

-to:

distributionUrl=http://services.gradle.org/distributions/gradle-2.3-all.zip
5
votes

There is a problem with the SSL certificate configuration on services.gradle.org right now

http://discuss.gradle.org/t/urgent-ssl-apache-configuration-for-services-gradle-org-is-bad/8808

The devs are aware and working on a fix.

This answer to the same question provides a workaround which may be suitable:

https://stackoverflow.com/a/29576568/4776802