Force Gradle to use HTTP instead of HTTPS

前端 未结 4 950
清歌不尽
清歌不尽 2020-12-15 06:00

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         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-15 06:29

    I had same problem and fixed it.

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

    if you add

    maven { url "http://jcenter.bintray.com" }
    

    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 "http://jcenter.bintray.com" }
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.3.1'
        }
    }
    
    allprojects {
        repositories {
            maven { url "http://jcenter.bintray.com" }
        }
    }
    

提交回复
热议问题