Recently migrating some projects to Android Studio, using the Gradle build is really a lot easier than the original ant. However, it is really painful to download the dependent speed at compile time.
If you can switch to a domestic MAVEN image warehouse, such as open source China's Maven library, or replace it with a self-built MAVEN, it must be excellent.
An easy way to modify the Build.gradle in the project root directory is to replace it with the following jcenter()
mavenCentral()
:
allprojects { repositories { 'http://maven.oschina.net/content/groups/public/ ' } }}
But Jiabuzhu project more, difficult not to change each?
Naturally there is a convenient way, the following copy to the name of the init.gradle
file, and save to the USER_HOME/.gradle/
folder.
allprojects{repositories {def repository_url='Http://maven.oschina.net/content/groups/public'All {artifactrepository repo-if(Repo instanceof mavenartifactrepository) {def URL=repo.url.toString ()if(Url.startswith ('Https://repo1.maven.org/maven2') || Url.startswith ('https://jcenter.bintray.com/') ) {project.logger.lifecycle"Repository ${repo.url} replaced by $REPOSITORY _url."remove Repo}} } maven {URL repository_url} }}
init.gradle
The file is actually Gradle 初始化脚本
(initialization Scripts) and is the global configuration of the runtime.
Gradle Modifying the Maven warehouse address