Gradle + Android
What it is + How to get up to speed
What is Gradle?
✤ Build system!
✤ Language independent!
✤ Flexible dependency
✤ Built on Groovy!
✤ Future of android development
Why should you use Gradle?
✤ Easy setup with Gradle wrapper !
✤ Make builds faster!
✤ Separate editor and compiler!
✤ More control over your builds!
✤ Control build tools versions!
✤ Change properties!
✤ Manage dependencies
✤ No installation of gradle is needed after setting up !
✤ Sets your version of gradle and where to look for it!
✤ Works for *NIX and Windows!
✤ ./gradlew tasks will list what you can do
Faster you say?
✤ Incremental builds!
✤ Avoid work you don’t need easily ex. only lint debug
builds and proguard release builds!
✤ Set ﬂags in settings.gradle to make gradle faster
Freedom to update
✤ IDE updates can’t break the build!
✤ Android tool updates can’t break the build!
✤ install<buildtype> will assemble your apk and install it to the
✤ Dependencies are stored locally in the build directory
It is all about control
apply plugin: ‘android’
//Where should I find the android tools
//What version of the android tools
//Tell gradle to we want to use the
//Where are the android dependancies
BuildTypes and BuildFlavors
✤ Ex. Debug, Beta, Release!
✤ Change package!
✤ Change signing key
✤ Ex. Architecture,
✤ Can be grouped !
✤ Can have different src
and res directories
✤ ./gradlew uninstall[flavor] will uninstall the previous version!
✤ Shorten commands with camel case ex.
✤ Handy command line arguments
--offline ﬂag while building to not go to the server
--refresh-dependencies to tell Gradle to fetch all new dependencies !
✤ Dependencies are cached for 24 hours but you can change how long
resolutionStrategy.cacheDynamicVersionsFor 4, ‘hours’
✤ .aar ﬁle is a zip. you can unzip it to see what’s inside.!
✤ Install the groovy shell to quickly verify that your groovy does what it is supposed to!
✤ Start by watching this Google IO talk: http://
✤ Get up to speed with Groovy: http://groovy.codehaus.org/
✤ Get up to speed with Gradle: http://fbﬂex.wordpress.com/
✤ More info about resource merging http://tools.android.com/
Thanks for coming
Follow me on twitter @reidbaker
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.