buildscript { repositories { maven { url'http://maven.aliyun.com/nexus/content/groups/public/'} jcenter() } dependencies { classpath'com.android.tools.build:gradle:2.2.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() } }
转:https://my.oschina.net/ranvane/blog/820262
步骤一:进入GRADLE_USER_HOME 一般情况下是C:\Users\Administrator.gradle\这个目录,如果你还没有配置过,这个目录是不会变的,我们讲windows下,linux用户大同小异。 C:\Users\Administrator.gradle\ 步骤二:新建一个init.gradle文件 该文件是每一个Gradle 项目执行之前的脚本文件 步骤三:文件中填入如下内容 allprojects { repositories { mavenLocal() maven { name "Alibaba" ; url "https://maven.aliyun.com/repository/public" } maven { name "Bstek" ; url "http://nexus.bsdn.org/content/groups/public/" } } }
另外一个连插件都帮你配置好了 allprojects { repositories { mavenLocal() maven { name "Alibaba" ; url "https://maven.aliyun.com/repository/public" } maven { name "Bstek" ; url "http://nexus.bsdn.org/content/groups/public/" } } buildscript { repositories { maven { name "Alibaba" ; url 'https://maven.aliyun.com/repository/public' } maven { name "Bstek" ; url 'http://nexus.bsdn.org/content/groups/public/' } maven { name "M2" ; url 'https://plugins.gradle.org/m2/' } } } }