Android stuido新建Project Gradle:Download https:// jcenter.bintray.com/ 下载慢,超时问题解决方法。

 

转载请标明出处:https://blog.csdn.net/mars314/article/details/81910789

网上搜索资料说的两种方式,自己也发现一种放到这里总结一下。

 

方法一:

https 改成 http 协议下载,修改项目根目录下 build.gradle 文件:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
//        jcenter()
        jcenter(){url 'http://jcenter.bintray.com/'}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
//        jcenter()
        jcenter(){url 'http://jcenter.bintray.com/'}
    }
}

亲测,此方法成功率很低。

方法二:

切换到国内的Maven镜像仓库。
修改项目根目录下 build.gradle 文件,将 jcenter() 或者 mavenCentral() 替换掉即可。可以用国内的仓库代替:

buildscript {
    
    repositories {
    maven{ url 'http://maven.aliyun.com/nexus/content/repositories/central/'}
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
    maven{ url 'http://maven.aliyun.com/nexus/content/repositories/central/'}
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

亲测,很有效;阿里有效,OSChina自行验证。

 

方法三:

手机开热点,电脑连接上手机热点,用手机完成;

亲测有效。

 

方法四:

万能方法,此方法怎么着都行,离线gradle都成。下载https://download.csdn.net/download/mars314/10618153覆盖你的gradle,可解决无法下jcenter缓慢超时问题!

 

总结:原地址:https:// jcenter.bintray.com/一亘有一次下载成功了,以后都会成功。修改协议:后续工程也得修改协议/

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值