java.lang.RuntimeException_ Verification of Gradle distribution failed

0 阅读1分钟
Could not install Gradle distribution from 'https://mirrors.aliyun.com/macports/distfiles/gradle/gradle-9.3.1-all.zip'.
Reason: java.lang.RuntimeException: Verification of Gradle distribution failed!

Your Gradle distribution may have been tampered with.
Confirm that the 'distributionSha256Sum' property in your gradle-wrapper.properties file is correct and you are downloading the wrapper from a trusted source.

Distribution Url: https://mirrors.aliyun.com/macports/distfiles/gradle/gradle-9.3.1-all.zip
Download Location: /home/ubuntu/.gradle/wrapper/dists/gradle-9.3.1-all/dcy4hoo9rbbb435xe0qkxpooy/gradle-9.3.1-all.zip
Expected checksum: 'b266d5ff6b90eada6dc3b20cb090e3731302e553a27c5d3e4df1f0d76beaff06'
Actual checksum:   '17f277867f6914d61b1aa02efab1ba7bb439ad652ca485cd8ca6842fccec6e43'
Visit https://gradle.org/release-checksums/ to verify the checksums of official distributions. If your build uses a custom distribution, see with its provider.

使用阿里云下载的gradle,校验不通过,checkSum不对。

原因

修改了gradle的版本,将gradle-9.3.1-bin.zip改为了gradle-9.3.1-all.zip,但是没有改distributionSha256Sum,下载成功后gradle发现不是同一文件,校验不通过。

解决方法

**方法一: 直接注释掉distributionSha256Sum **

方法二:改为对应的Sha256Sum。

gradle官网中找到对应的Sha256Sum。因为我这里用的是gradle-9.3.1-all,所以用下图对应的Sha256Sum

distributionSha256Sum=17f277867f6914d61b1aa02efab1ba7bb439ad652ca485cd8ca6842fccec6e43