Android Studio 2020新版本 卡在Gradle downloading / sync failed / 下载缓慢 / 下载超时 亲测有效解决办法

这个问题卡了我三天

头都疼了!

最终解决方法

新建一个项目,然后改两个文件
在这里插入图片描述

build.gradle里面改成这个:

buildscript {
    repositories {
        maven {
            url "http://maven.aliyun.com/nexus/content/groups/public/"
        }
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.1"

        // 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/groups/public/"
        }
        google()
        jcenter()
    }
}

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

gradle版本我选择4.1.1 上下两个文件里面的gradle版本要统一。

gradle-wrapper.properties这样改

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1.1-all.zip

在这里插入图片描述

三分钟下完加载完并且没有报错,阿里云牛!!!!!

以后凡是和Marven、Gradle这两个玩意相关的bug和问题,我一律aliyun镜像解决好吧!

猜你喜欢

转载自blog.csdn.net/qq_42915442/article/details/111412427