//buildscript里是gradle腳本執行所需依賴,分別是對應的maven庫和插件 buildscript { repositories { // google() // jcenter() maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' } maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'} maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' classpath 'com.novoda:bintray-release:+' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } //allprojects里是項目本身需要的依賴 allprojects { repositories { // google() // jcenter() maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' } maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'} maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } } tasks.withType(Javadoc) { // 新增 options.addStringOption('Xdoclint:none', '-quiet') options.addStringOption('encoding', 'UTF-8') } } task clean(type: Delete) { delete rootProject.buildDir }
buildscript里的repositories與allprojects里的repositories 區別:
1. buildscript里是gradle腳本執行所需依賴,分別是對應的maven庫和插件
2.allprojects里是項目本身需要的依賴
JCenter() 與 mavenCenter() 的區別
完美解決gradle依賴庫導致build慢的問題