Tuesday, March 10, 2015

Gradle tip - Leverage a top-level build.gradle

Usually a project contains more than one sub project or module. In that case you will want to have common settings that will be shared among them, saving you the trouble of rewriting them or maintaining future changes. A common setting will be the Android's buildscript dependency - classpath 'com.android.tools.build:gradle:x.y.z'


// 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:1.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
view raw build.gradle hosted with ❤ by GitHub

No comments:

Post a Comment