2023-06-18 as运行android项目报错:

发布时间 2023-06-18 10:32:46作者: 哎呦你可棒棒了

完整报错:

A problem occurred configuring root project '项目名'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Using insecure protocols with repositories, without explicit opt-in, is unsupported. 
     Switch Maven repository 'maven(http://maven.aliyun.com/nexus/content/groups/public/)'
     to redirect to a secure protocol (like HTTPS) or allow insecure protocols.
     See https://docs.gradle.org/7.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details. * Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.

原因:在下载gradle的时候使用不安全的http代理导致。

解决方案:修改你的build.gradle文件中的repositories中的maven,在maven中添加allowInsecureProtocol = true,如:

maven{
  url 'http://maven.aliyun.com/nexus/content/groups/public/'
allowInsecureProtocol = true
}

或者你可以直接把http改成https试一试。

OK,Try Agian。