close

[Solved] Allow insecure protocols android Gradle

Hello Guys, How are you all? Hope You all Are Fine. Today I just updated my android studio and now I am facing the following error Allow insecure protocols android Gradle in android. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Allow insecure protocols android Gradle Error Occurs ?

Today I just updated my android studio and now I am facing the following error while running my project.

A problem occurred configuring root project 'so10'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Using insecure protocols with repositories, without explicit opt-in, is     unsupported. Switch Maven repository 
'maven3(http://oss.sonatype.org/content/repositories/snapshots)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.
 See https://docs.gradle.org/7.0.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details. 

How To Solve Allow insecure protocols android Gradle Error ?

  1. How To Solve Allow insecure protocols android Gradle Error?

    To Solve Allow insecure protocols android Gradle Error In Gradle version 7+, we must need to specify a boolean allowInsecureProtocol as true to MavenArtifactRepository closure. Just as like below.

  2. Allow insecure protocols android Gradle

    To Solve Allow insecure protocols android Gradle Error In Gradle version 7+, we must need to specify a boolean allowInsecureProtocol as true to MavenArtifactRepository closure. Just as like below.

Solution 1

In Gradle version 7+, we must need to specify a boolean allowInsecureProtocol as true to MavenArtifactRepository closure. Just as like below.

repositories {
        // maven { url "https://maven.fabric.io/public" }
        maven {
            url "https://jitpack.io"
        }
        maven {
            url "https://raw.github.com/Raizlabs/maven-releases/master/releases"
        }
        maven {
            url "http://oss.sonatype.org/content/repositories/snapshots"
            allowInsecureProtocol = true //add this line
        }
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        maven { 
            url "https://maven.google.com"
        }
        google()
        mavenCentral()
        jcenter()
    }

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Leave a Comment