• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Using insecure protocols with repositories

xarzu

Newbie
I was trying to perform a gradle sync on my Android Studio project and it generated the following error.

A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:classpath'.
> Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven2(http://localhost/)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.3.3/dsl/o...s.UrlArtifactRepository:allowInsecureProtocol for more details.
Please advise. Have you seen this before? How did you fix this?
https://photos.app.goo.gl/9ZPCHcm1XqktCt4J8
 
you are trying to use an insecure protocol (HTTP) to access a Maven repository in your Gradle build. This is causing a problem because, as the error message states, using insecure protocols with repositories is unsupported.

To fix this issue, you will need to either:

  1. Switch to a secure protocol (such as HTTPS) when accessing the repository. This will require updating the repository URL in your build configuration to use HTTPS instead of HTTP.

  2. Allow insecure protocols to be used with repositories by adding the following line to your build configuration:
Code:
repositories {
    maven {
        url "http://localhost/"
        allowInsecureProtocols()
    }
}

Note that allowing insecure protocols to be used with repositories is generally not recommended, as it can pose a security risk. It is generally safer to switch to a secure protocol (such as HTTPS) whenever possible.
 
Back
Top Bottom