Android studio gradle下载速度慢 下载失败解决方法(网址最全)

问题一
android studio默认从Google下载gradle,下载速度超慢,还有可能下载失败,我们把下载网址改成阿里的就可以解决了,下载速度很快。

问题二
如果你的程序一打开就出现了Cause: unable to find valid certification path to requested target的报错,下面的方法也可以帮你解决。
在这里插入图片描述

1.打开build.gradle文件

在这里插入图片描述

2.将网址粘贴进去

在这里插入图片描述

网址如下:

buildscript {
    
    repositories {
        maven { url 'https://maven.aliyun.com/repository/public' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
        maven { url 'https://dl.bintray.com/guardian/android' }
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
        maven { url "https://jitpack.io" }
        google()
//        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.1'
    }
}

allprojects {
    repositories {
        maven { url 'https://maven.aliyun.com/repository/public' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
        maven { url 'https://dl.bintray.com/guardian/android' }
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
        maven { url "https://jitpack.io" }
        google()
//        jcenter()
    }
}

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

3.重新加载一下

在这里插入图片描述

注:

如果仍然下载不了不用怕,咱还有必杀技,把上面红框里的内容换成下面的,亲测有效,但是有一个缺点可能一次成功不了,每次可能只下载一点就报错了,但是多试几次就可以了。
在这里插入图片描述


buildscript {
    
    repositories {
    	//复制下面四行
        mavenCentral()
        jcenter()
        mavenLocal()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
    }
}

allprojects {
    repositories {
    	//复制下面四行
        mavenCentral()
        jcenter()
        mavenLocal()
        google()
    }
}

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

如果仍然有Cause: unable to find valid certification path to requested target的报错信息,估计你要下载证书了,推荐看看这篇文章:关于AndroidStudio Cause: unable to find valid certification path to requested target 报错的解决方法

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值