Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow insecure protocols, android gradle

I recently updated my android studio to Arctic Fox and got an error in 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.  

This is my gradle where the problem occurs

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'}     maven { url "https://plugins.gradle.org/m2/" }     maven { url 'https://maven.google.com'  }     google()     mavenCentral()     jcenter() } 

How do I solve it?

like image 943
WISHY Avatar asked Jul 30 '21 05:07

WISHY


People also ask

How do I allow insecure protocol in gradle?

For insecure HTTP connections in Gradle 7+ versions, we need to specify a boolean allowInsecureProtocol as true to MavenArtifactRepository closure. Since you have received this error for sonatype repository, you need to set the repositories as below: Groovy DSL.

What is init gradle?

Similar to a Gradle build script, an init script is a Groovy or Kotlin script. Each init script has a Gradle instance associated with it. Any property reference and method call in the init script will delegate to this Gradle instance. Each init script also implements the Script interface.


1 Answers

For insecure HTTP connections in Gradle 7+ versions, we need to specify a boolean allowInsecureProtocol as true to MavenArtifactRepository closure.
Since you have received this error for sonatype repository, you need to set the repositories as 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     }     maven {         url "https://plugins.gradle.org/m2/"     }     maven {         url "https://maven.google.com"     }     google()     mavenCentral()     jcenter() } 
like image 191
Jay Avatar answered Sep 28 '22 07:09

Jay