Gradle包装器标签不匹配错误 [英] Gradle wrapper Tag Mismatch error
问题描述
我正在尝试使用gradle及其包装器手动配置Android项目,但是我总是遇到相同的错误.
I'm trying to manually configure an Android project using gradle and its wrapper, but I always have the same error.
我可以使用以下 build.gadle
文件生成 gradlew
脚本:
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'
}
启动 gradlew
脚本时,我收到一个SSL错误,这是堆栈跟踪:
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
推荐答案
所以我终于想出了一个解决方案.事实证明,通过HTTPS从 http://services.gradle.org/distributions/下载包装程序不会当时似乎无法正常工作.
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.
然后我遇到另一个问题,下载的档案已损坏...因此,诀窍是从导航器下载档案,然后在 gradle/wrapper/gradle-wrapper中的路径中手动提取档案.properties
文件,然后它就像一个吊饰一样!
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!
希望这些服务器将很快修复.我仍然想知道问题是否出在我的Java安装上,但是,我正在运行Arch Linux,并尝试了 openjdk8
, jdk8
和 jdk7 每次更改版本时,要么错误消息和stacktrace不同,要么我领先一步.我将在Windows上尝试并更新此帖子.
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.
编辑1 :事实证明,它在Windows上运行良好!问题来自我的Java安装.
EDIT 1: Turns out it works perfectly fine on Windows! The problem comes from my Java installation.
编辑2 :我在一个朋友的Internet连接上尝试了其他地方,并感到它像一个魅力一样令人惊讶...问题可能出在我的ISP(免费)或他们给我的路由器上.
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.
这篇关于Gradle包装器标签不匹配错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!