解决Android Stdio 一直下载Gradle问题

解决Android Stdio 一直下载Gradle问题

AMENG
2021-03-29 / 0 评论 / 0 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2021年09月24日,已超过943天没有更新,若内容或图片失效,请留言反馈。

由于这软件是谷歌的,故一些环境下载服务器都在国外,由于国内被墙了,故无法下载。

解决办法:打开build.gradle

添加阿里服务器

[cpp]

maven<span class="token punctuation">{</span> url <span class="token string">'http://maven.aliyun.com/nexus/content/groups/public/'</span><span class="token punctuation">}</span>

[/cpp]

[cpp]

maven<span class="token punctuation">{</span> url<span class="token string">'http://maven.aliyun.com/nexus/content/repositories/jcenter'</span><span class="token punctuation">}</span>

[/cpp]

修改后如下

[cpp]

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

buildscript {
repositories {
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
google()
maven{ url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
<span style="color: #ff0000;">//必须写在JCenter上边</span>
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'

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

allprojects {
repositories {
google()
maven{ url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
//必须写在JCenter上边
jcenter()
maven { url "https://jitpack.io" }
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}
}

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

[/cpp]

0

评论 (0)

取消