android studio打开项目Gradle Download:https://jcenter.bintray.com/ 一直加载解决方案

目录

0、相关文章:

1、正文:

1.1、修改build.gradle文件:


0、相关文章:

android studio打开项目Gradle Download:https://jcenter.bintray.com/ 一直加载解决方案(阅读量1.3w)

Android stuido新建Project Gradle:Download https:// jcenter.bintray.com/ 下载慢,超时问题解决方法。(阅读量4k,有四种方法)

1、正文:

Gradle:Download https://jcenter.bintray.com/com/android/tools/build/gradle-core/2.2.2/gradle-core-2.2.2-sources.jar

出现此种情况的原因:一般在打开下载好的第三方的源码时会执行下载任务,原因是因为下载文件被墙了。

解决方案:

1.1、修改build.gradle文件:

方法一:切换到国内的Maven镜像仓库。

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

如下:效果很不错,不到五分钟就下载好了。

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

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

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

task clean(type: Delete) {
    delete rootProject.buildDir
}
发布了632 篇原创文章 · 获赞 758 · 访问量 51万+

猜你喜欢

转载自blog.csdn.net/songzi1228/article/details/103770126