使用 allowInsecureProtocol 属性解决 gradle 的仓库地址HTTPS警告

1,210 阅读1分钟

使用 allowInsecureProtocol 属性解决 gradle 的仓库地址HTTPS警告

gradle高版本会出现maven仓库地址不是https安全连接便会报错的问题;

1.报错现象

Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.

Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven2(mvn.xxxxxx.com/content/gro…' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See docs.gradle.org/7.2/dsl/org… for more details.

2.解决办法

maven {

allowInsecureProtocol = true

url 'mvn.xxxxxx.com/content/gro…'

}

添加属性设置: allowInsecureProtocol = true