Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle wrapper Tag Mismatch error

I'm trying to manually configure an Android project using gradle and its wrapper, but I always have the same error.

I can generate the gradlew script with the following build.gadle file:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.1'
    }
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.1"
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.6'
}

When I launch the gradlew script I get an SSL error, here is the stacktrace:

Downloading https://services.gradle.org/distributions/gradle-2.6-bin.zip
...............
Exception in thread "main" javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: Tag mismatch!
        at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1541)
        at sun.security.ssl.AppInputStream.available(AppInputStream.java:60)
        at java.io.BufferedInputStream.available(BufferedInputStream.java:410)
        at sun.net.www.MeteredStream.available(MeteredStream.java:170)
        at sun.net.www.http.KeepAliveStream.close(KeepAliveStream.java:85)
        at java.io.FilterInputStream.close(FilterInputStream.java:181)
        at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.close(HttpURLConnection.java:3408)
        at org.gradle.wrapper.Download.downloadInternal(Download.java:77)
        at org.gradle.wrapper.Download.download(Download.java:44)
        at org.gradle.wrapper.Install$1.call(Install.java:62)
        at org.gradle.wrapper.Install$1.call(Install.java:48)
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
        at org.gradle.wrapper.Install.createDist(Install.java:48)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: javax.net.ssl.SSLException: Tag mismatch!
        at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
        at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1020)
        at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:930)
        at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
        at sun.net.www.MeteredStream.read(MeteredStream.java:134)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3335)
        at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3328)
        at org.gradle.wrapper.Download.downloadInternal(Download.java:62)
        ... 7 more
Caused by: javax.crypto.AEADBadTagException: Tag mismatch!
        at com.sun.crypto.provider.GaloisCounterMode.decryptFinal(GaloisCounterMode.java:524)
        at com.sun.crypto.provider.CipherCore.finalNoPadding(CipherCore.java:1023)
        at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:960)
        at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:479)
        at javax.crypto.Cipher.doFinal(Cipher.java:2377)
        at sun.security.ssl.CipherBox.decrypt(CipherBox.java:461)
        at sun.security.ssl.InputRecord.decrypt(InputRecord.java:172)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1015)
        ... 16 more
like image 909
Ganitzsh Avatar asked Mar 14 '23 19:03

Ganitzsh


2 Answers

So I finally came up with a solution. Turns out that downloading the wrapper via HTTPS from http://services.gradle.org/distributions/ doesn't seem to be working correctly at the time.

Then I got in front of another problem, the downloaded archive is corrupted... So the trick is to download the archive from your navigator and extract it manually in the path in the gradle/wrapper/gradle-wrapper.properties file and then it works like a charm!

Hopefully, the servers will be fixed soon. I am still wondering if the problem doesn't come from my Java installation, though, I'm running Arch Linux and tried openjdk8, jdk8 and jdk7 every time I changed the version, either I got one step ahead either the error message and stacktrace was different. I will try on windows and update this post.

EDIT 1: Turns out it works perfectly fine on Windows! The problem comes from my Java installation.

EDIT 2: I tried somewhere else on a friend's internet connection and surprise it worked like a charm... The problem is probably my ISP (Free) or the router they gave me.

like image 109
Ganitzsh Avatar answered Mar 28 '23 03:03

Ganitzsh


I've managed to solve the issue by connecting to a VPN and perform a re-sync. The download was successful and the sync to. So it seems we're having a network issue.

like image 27
Herve Mutombo Avatar answered Mar 28 '23 05:03

Herve Mutombo