Monday, March 30, 2015

Gradle tip - Set names to your modules

Set names to your modules/sub-projects. The name for your module/sub-project will be defined according to the filesystem directory it's in. You can change naming for better readability later on, using:
include ':SDK'
project(':SDK').projectDir = new File('MySdkProjectDirectory/')


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