关于Gradle7.0及以上版本报Https的错误的解决方案

2022-05-06 08:59:16 浏览数 (1)

今天在升级Android项目的gradle时,遇到如下的一个错误:

官方的解释是:

代码语言:javascript复制
Specifies whether it is acceptable to communicate with a repository over an insecure HTTP connection.

For security purposes this intentionally requires a user to opt-in to using insecure protocols on case by case basis.

Gradle intentionally does not offer a global system/gradle property that allows a universal disable of this check.

*Allowing communication over insecure protocols allows for a man-in-the-middle to impersonate the intended server, and gives an attacker the ability to [serve malicious executable code onto the system.](https://max.computer/blog/how-to-take-over-the-computer-of-any-java-or-clojure-or-scala-developer/)*

大概意思是为了安全,需要要升级成Https,修改的方式有两种。一种是将maven的http修改成为https,另一种是忽略警告,在maven中添加allowInsecureProtocol,比如:

代码语言:javascript复制
maven {
            allowInsecureProtocol = true
            url 'http://developer.huawei.com/repo/'
}

0 人点赞