SlideShare a Scribd company logo
Reid Baker
Gradle + Android
What it is + How to get up to speed
01
What is Gradle?
✤ Build system!
✤ Language independent!
✤ Flexible dependency
management !
✤ 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
GradleWrapper
✤ 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 flags in settings.gradle to make gradle faster

org.gradle.daemon=true
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
connected device!
✤ Dependencies are stored locally in the build directory
It is all about control
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.10.+'
}
}
apply plugin: ‘android’
!
repositories {
maven {
url “https://maven.vpn.etonreve.com/repo”
}
}
!
//Where should I find the android tools
//What version of the android tools
!
//Tell gradle to we want to use the
android plugin
!
//Where are the android dependancies
located
Control over your apk
android {
compileSdkVersion 17
buildToolsVersion "19.0.1"
!
sourceSets.main {
java.srcDirs = ['src']
res.srcDirs = ['res']
manifest.srcFile ‘AndroidManifest.xml’
}
!
buildTypes {
debug {
debuggable true //unnecessary
packageNameSuffix '.dev'
if (someVariable) {
signingConfig signingConfigs.release
}
}
<Other release types>
}
}
Dependency management
dependencies {
compile project(“:libraries:skitchkit-android")
!
compile ‘com.android.support:support-v4:19.0.+’
!
compile ('com.actionbarsherlock:actionbarsherlock:4.4.0@aar') {
exclude group: 'com.android.support', module: 'support-v4'
}
!
compile files('/Users/rbaker/dev/google-play-services.jar')
!
provided 'com.google.android.maps:maps:16_r2'
}
BuildTypes and BuildFlavors
Release Types!
✤ Ex. Debug, Beta, Release!
✤ Change package!
✤ Change signing key
Build flavors!
✤ Ex. Architecture, 

Free/Premium

Branding!
✤ Can be grouped !
✤ Can have different src
and res directories
Lets look at a real build file
Tips andTricks
✤ ./gradlew uninstall[flavor] will uninstall the previous version!
✤ Shorten commands with camel case ex.

./gradlew installAllArchEvernoteDebug

./gradlew iAAED!
!
!
✤ Handy command line arguments

--offline flag 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

configurations.all {

resolutionStrategy.cacheDynamicVersionsFor 4, ‘hours’

}!
!
✤ .aar file 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!
Additional Resources
✤ Start by watching this Google IO talk: http://
www.youtube.com/watch?v=LCJAgPkpmR0!
✤ Get up to speed with Groovy: http://groovy.codehaus.org/
Groovy+style+and+language+feature+guidelines+for+Java
+developers!
✤ Get up to speed with Gradle: http://fbflex.wordpress.com/
2013/05/01/12-new-things-i-learned-from-a-three-day-
gradle-training/!
✤ More info about resource merging  http://tools.android.com/
tech-docs/new-build-system/resource-merging
Thanks for coming
Follow me on twitter @reidbaker

More Related Content

PPTX
Gradle and Android Studio : Best of Friends
PDF
Gradle & Android Studio - Introduction
PDF
Gradle enabled android project
PDF
New to android studio
PDF
Entwicklung mit Android Studio und Gradle
PPTX
Android Studio簡介
PDF
[Ultracode Munich #4] Short introduction to the new Android build system incl...
PPTX
Introduction to android studio 2.0 and data binding library
Gradle and Android Studio : Best of Friends
Gradle & Android Studio - Introduction
Gradle enabled android project
New to android studio
Entwicklung mit Android Studio und Gradle
Android Studio簡介
[Ultracode Munich #4] Short introduction to the new Android build system incl...
Introduction to android studio 2.0 and data binding library

What's hot (20)

PDF
Javaone - Gradle: Harder, Better, Stronger, Faster
PDF
A/B test your Android build setup with ASPoet
PPTX
Golang start and tips
PDF
Android studio
PDF
Getting started with building your own standalone Gradle plugin
PPTX
Continuously Break The Android
PDF
Introduction to Android Studio
PDF
(Live) build and run golang web server on android.avi
PDF
Intro to Flutter
PPT
Google Web Toolkit
ODP
OOoEclipse talks now C++
PDF
Google App Engine Developer - Day1
PDF
React Nativeアプリをリリースし続けるために、最初に行う8つの取り組み
PDF
Android Made Simple
PPTX
Android Studio 3 - Dependency-Aware Build Variants and Product Flavors
PDF
Building at a glance
PPTX
Intro to Flutter SDK
PDF
Improving the developer experience on OpenShift - devconf-india-18
PPTX
Introduction to React Native
Javaone - Gradle: Harder, Better, Stronger, Faster
A/B test your Android build setup with ASPoet
Golang start and tips
Android studio
Getting started with building your own standalone Gradle plugin
Continuously Break The Android
Introduction to Android Studio
(Live) build and run golang web server on android.avi
Intro to Flutter
Google Web Toolkit
OOoEclipse talks now C++
Google App Engine Developer - Day1
React Nativeアプリをリリースし続けるために、最初に行う8つの取り組み
Android Made Simple
Android Studio 3 - Dependency-Aware Build Variants and Product Flavors
Building at a glance
Intro to Flutter SDK
Improving the developer experience on OpenShift - devconf-india-18
Introduction to React Native
Ad

Similar to Intro to Gradle + How to get up to speed (20)

PDF
Head first android apps dev tools
PPTX
Gradle,the new build system for android
PPTX
Android, Gradle & Dependecies
PPTX
Android presentation - Gradle ++
PPTX
Exploring the power of Gradle in android studio - Basics & Beyond
PDF
Michal Havryluk: How To Speed Up Android Gradle Builds
PPTX
Gradle build capabilities
PDF
Gradle presentation
PDF
Android gradle-build-system-overview
PDF
Building android apps with Gradle (GREACH 2015)
PPTX
Build your android app with gradle
PDF
Антон Руткевич, Сборка Android-библиотеки нового поколения с помощью Gradle
PDF
Moderne Android Builds mit Gradle
PDF
Gradle-based Android Build System
PPTX
A brief guide to android gradle
PDF
PPTX
Building next gen android library with gradle
PDF
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
PDF
Making the Most of Your Gradle Builds
PDF
Gradle 101
Head first android apps dev tools
Gradle,the new build system for android
Android, Gradle & Dependecies
Android presentation - Gradle ++
Exploring the power of Gradle in android studio - Basics & Beyond
Michal Havryluk: How To Speed Up Android Gradle Builds
Gradle build capabilities
Gradle presentation
Android gradle-build-system-overview
Building android apps with Gradle (GREACH 2015)
Build your android app with gradle
Антон Руткевич, Сборка Android-библиотеки нового поколения с помощью Gradle
Moderne Android Builds mit Gradle
Gradle-based Android Build System
A brief guide to android gradle
Building next gen android library with gradle
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
Making the Most of Your Gradle Builds
Gradle 101
Ad

Recently uploaded (20)

PDF
Cost to Outsource Software Development in 2025
PDF
17 Powerful Integrations Your Next-Gen MLM Software Needs
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
history of c programming in notes for students .pptx
PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
Complete Guide to Website Development in Malaysia for SMEs
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
Autodesk AutoCAD Crack Free Download 2025
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
Cost to Outsource Software Development in 2025
17 Powerful Integrations Your Next-Gen MLM Software Needs
CHAPTER 2 - PM Management and IT Context
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Computer Software and OS of computer science of grade 11.pptx
history of c programming in notes for students .pptx
Oracle Fusion HCM Cloud Demo for Beginners
Patient Appointment Booking in Odoo with online payment
Salesforce Agentforce AI Implementation.pdf
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Complete Guide to Website Development in Malaysia for SMEs
Advanced SystemCare Ultimate Crack + Portable (2025)
Autodesk AutoCAD Crack Free Download 2025
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Why Generative AI is the Future of Content, Code & Creativity?

Intro to Gradle + How to get up to speed

  • 1. Reid Baker Gradle + Android What it is + How to get up to speed
  • 2. 01 What is Gradle? ✤ Build system! ✤ Language independent! ✤ Flexible dependency management ! ✤ Built on Groovy! ✤ Future of android development
  • 3. 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
  • 4. GradleWrapper ✤ 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
  • 5. Faster you say? ✤ Incremental builds! ✤ Avoid work you don’t need easily ex. only lint debug builds and proguard release builds! ✤ Set flags in settings.gradle to make gradle faster
 org.gradle.daemon=true
  • 6. 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 connected device! ✤ Dependencies are stored locally in the build directory
  • 7. It is all about control buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.10.+' } } apply plugin: ‘android’ ! repositories { maven { url “https://maven.vpn.etonreve.com/repo” } } ! //Where should I find the android tools //What version of the android tools ! //Tell gradle to we want to use the android plugin ! //Where are the android dependancies located
  • 8. Control over your apk android { compileSdkVersion 17 buildToolsVersion "19.0.1" ! sourceSets.main { java.srcDirs = ['src'] res.srcDirs = ['res'] manifest.srcFile ‘AndroidManifest.xml’ } ! buildTypes { debug { debuggable true //unnecessary packageNameSuffix '.dev' if (someVariable) { signingConfig signingConfigs.release } } <Other release types> } }
  • 9. Dependency management dependencies { compile project(“:libraries:skitchkit-android") ! compile ‘com.android.support:support-v4:19.0.+’ ! compile ('com.actionbarsherlock:actionbarsherlock:4.4.0@aar') { exclude group: 'com.android.support', module: 'support-v4' } ! compile files('/Users/rbaker/dev/google-play-services.jar') ! provided 'com.google.android.maps:maps:16_r2' }
  • 10. BuildTypes and BuildFlavors Release Types! ✤ Ex. Debug, Beta, Release! ✤ Change package! ✤ Change signing key Build flavors! ✤ Ex. Architecture, 
 Free/Premium
 Branding! ✤ Can be grouped ! ✤ Can have different src and res directories
  • 11. Lets look at a real build file
  • 12. Tips andTricks ✤ ./gradlew uninstall[flavor] will uninstall the previous version! ✤ Shorten commands with camel case ex.
 ./gradlew installAllArchEvernoteDebug
 ./gradlew iAAED! ! ! ✤ Handy command line arguments
 --offline flag 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
 configurations.all {
 resolutionStrategy.cacheDynamicVersionsFor 4, ‘hours’
 }! ! ✤ .aar file 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!
  • 13. Additional Resources ✤ Start by watching this Google IO talk: http:// www.youtube.com/watch?v=LCJAgPkpmR0! ✤ Get up to speed with Groovy: http://groovy.codehaus.org/ Groovy+style+and+language+feature+guidelines+for+Java +developers! ✤ Get up to speed with Gradle: http://fbflex.wordpress.com/ 2013/05/01/12-new-things-i-learned-from-a-three-day- gradle-training/! ✤ More info about resource merging  http://tools.android.com/ tech-docs/new-build-system/resource-merging
  • 14. Thanks for coming Follow me on twitter @reidbaker