在构建项目时提示如下,大概意思是使用了不安全的http协议,切换到https或者允许不安全协议。
bashUsing insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven(XXX)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols
下面就是允许不安全协议http的方法。
1.在 build.gradle 的maven中添加 allowInsecureProtocol = true ,如下
maven {
allowInsecureProtocol = true
url 'http://xxx.xxx.xxx/repository/public/'
}
此方法可以解决大部分情况下的问题。
如果还没有解决,大概率是gradle配置了公共镜像库。
如果使用了公共镜像,有这个配置文件 init.gradle 还需要去配置文件中删除。
进入到gradle安装目录下的init.d,打开 init.gradle 。
并删除其中http开头的链接,再去重新构建。