用android studio 打开一个新的项目,有的时候会很慢 。这可能是因为下载gradle版本太慢的问题,因为国内墙的问题。 这是解决办法就是采用国内镜像地址
使用阿里云国内镜像
对单个项目生效,在项目中的build.gradle修改内容
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
这两行一定要放在jcenter()上面。注意,注意,注意。
修改后内容大概是这样的
buildscript {
repositories {
google()
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.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/groups/public/' }
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

被折叠的 条评论
为什么被折叠?



