android – Force Gradle to use HTTP instead of HTTPS-ThrowExceptions

Exception or error:

I am trying to build react-native android app, as a dependecy I see I have gradle, but it fails to load on build.
Error message:

* What went wrong:
A problem occurred configuring root project 'MobileApp'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve
     Required by:
      > Could not resolve
         > Could not get resource ''.
            > Could not GET ''.
               > Connection to refused

The issue is clear, I am sitting behind corporate proxy that blocks any HTTPSconnections like these in error.
So my questions are: how to force gradle to use HTTP in loading these files? Where these properties should be put(which of gradle files, i.e.

P.S. I already have set these in gradle properties file:

systemProp.http.proxyHost= myHost
systemProp.http.proxyPort= myPort
systemProp.http.proxyUser= myUser
systemProp.http.proxyPassword= myPassword

Any links, suggestions or etc. will help a lot.

How to solve:

I had same problem and fixed it.

gradle is forced to get dependencies from jcenter through https proxy.

if you add

maven { url "" }

in your repositories instead of jcenter(), gradle sees this repository as a simple maven repository with http proxy.

your project build.gradle should be like below:

buildscript {
    repositories {
        maven { url "" }
    dependencies {
        classpath ''

allprojects {
    repositories {
        maven { url "" }


replace jcenter() with jcenter { url ““} in build.gradle


Try this

  • run a proxy like freegate

  • the root path project in cmd type

    gradlew -Dhttps.proxyHost= -Dhttps.proxyPort=8580

File -> Settings -> Project Settings -> Gradle -> Global Gradle Settings -> Gradle VM Options


Leave a Reply

Your email address will not be published. Required fields are marked *