项目全局build.gradle
一个完整的项目全局build.gradle文件,如下所示。
- // Top-level build file where you can add configuration options common to all sub-projects/modules.
- buildscript {
- repositories {
- jcenter()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
- }
- allprojects {
- repositories {
- jcenter()
- }
- }
- task clean(type: Delete) {
- delete rootProject.buildDir
- }
实际上,项目全局的build.gradle文件中最重要的就是buildscript的部分代码。在buildscript中,Gradle指定了使用jcenter代码仓库,同时声明了依赖的Android Gradle插件的版本。
在allprojects领域中,开发者可以为项目整体配置一些属性。
