. Advertisement .
..3..
. Advertisement .
..4..
Android is an open-source Linux-based operating system designed for touch screen mobile devices such as smartphones and tablets.
When you try to complete your task, you get this problem: “Allow insecure protocols android Gradle in Android“.
This error is one of the most popular errors any programmer will make. So, why does it appear, and how can it be resolved? We’ll go over it with you.
Why Does The problem: Allow insecure protocols android Gradle in Android Occur?
Android is a Linux-based operating system designed for touch screen mobile devices such as smartphones and tablets. Initially, Android was developed by Android Inc. with financial support from Google and later acquired by Google itself in 2005.
You recently updated your Android Studio, and now you are getting the following problem when running your 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.
The Effective Method For You
Method 1: Add allowInsecureProtocol=true to the (windows) C
Specific paths are as follows:
(Windows) C:\Users\<userid>\.gradle\init.gradle file
Method 2:
You can use the following code to solve your error in this solution.
You must specify a boolean to allowInsecureProtocol as true to MavenArtifactRepository closure in Gradle versions 7+. Just like in the example 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()
}
We believe that the above method will be beneficial to all of you.
Method 3: Note to gradle.properties
If you’re using the value from gradle.properties as your repository URL, setting allowInsecureProtocolfor that repository is the right way to go.
If your application uses HTTP URLs, this doesn’t cause the deprecation alert. There’s no method to mark a property that is part of gradle.properties as being an “safe” URL. These are simply keys and values.
Method 4: using the Kotlin DSL
using the Kotlin DSL, the property name is different isAllowInsecureProtocol
maven {
url = uri("http://oss.sonatype.org/content/repositories/snapshots")
isAllowInsecureProtocol = true
}
Conclusion
The solutions mentioned above are the best options for those still confused with this error: “Allow insecure protocols android Gradle in Android”.
If you need our support or have other questions, we have a thriving community where everyone is always willing to help. Finally, we wish you a productive day filled with new solutions and code.
Just clarify this situation and hope it is useful
In Gradle 7+ versions, we need to specify a boolean allowInsecureProtocol as true to
MavenArtifactRepository
closure. you have to set the repositories if you receive the error forsonatype
repository: