赞
踩
注意:不用进行设置代理,也就时Setting/HTTP Poxy那里设置成no proxy即可
allprojects{ repositories { def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public' def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter' all { ArtifactRepository repo -> if(repo instanceof MavenArtifactRepository){ def url = repo.url.toString() if (url.startsWith('https://repo1.maven.org/maven2')) { project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL." remove repo } if (url.startsWith('https://jcenter.bintray.com/')) { project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL." remove repo } } } maven { url ALIYUN_REPOSITORY_URL url ALIYUN_JCENTER_URL } } }
说明:为啥单单修改里面的某一个项目的build.gradle配置就可以对所有项目生效呢?
因为AndroidStudio内置缓存机制,当你重新打开AndroidStudio时就会将build.gradle的配置在所有的项目中重新修改并生效
具体位置如下:
buildscript { repositories { maven { url "http://maven.aliyun.com/nexus/content/groups/public/" } jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' // 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/" } jcenter() } } task clean(type: Delete) { delete rootProject.buildDir }
gradle-plugin版本号:在项目的gradle.properties里面
gradle版本号:在builde.gradle里面
Plugin version | gradle版本 |
---|---|
1.0.0 - 1.1.3 | 2.2.1 - 2.3 |
1.2.0 - 1.3.1 | 2.2.1 - 2.9 |
1.5.0 | 2.2.1 - 2.1.3 |
2.1.3 - 2.2.3 | 2.14.1+ |
2.3.0+ | 3.3+ |
3.0.0+ | 4.1+ |
3.1.0 | 4.4+ |
3.2.0 - 3.2.1 | 4.6+ |
3.3.0 - 3.3.2 | 4.10.1+ |
3.4.0 - 3.4.1 | 5.1.1+ |
3.5.0 | 5.4.1+ |
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。