SlideShare una empresa de Scribd logo
1 de 30
Descargar para leer sin conexión
BUILDING ANDROID APPSBUILDING ANDROID APPS
WITH GRADLEWITH GRADLE
GREACH 2015, Madrid
René Gröschke
Principal Engineer Gradleware
INTRO, DEMO & FORECASTINTRO, DEMO & FORECAST
WHY A NEW BUILDWHY A NEW BUILD
SYSTEM?SYSTEM?
GRADLE 2.3GRADLE 2.3
RELEASED 16TH FEBRUARY 2015RELEASED 16TH FEBRUARY 2015
OLD ANDROID BUILDSOLD ANDROID BUILDS
Two (official) build mechanism
ADT (Eclipse based)
Ant
Maven
Customization?
Nothing in ADT
Manually hacking xml in ant scripts
REQUIREMENTS OF THEREQUIREMENTS OF THE
NEW BUILD SYSTEMNEW BUILD SYSTEM
Use same system for
CommandLine
CI Server
IDE
Support for application/library variants
Dependency Management
Provide a plugin ecosystem
WHY GRADLEWHY GRADLE
Allows custom DSL to express build logic
Very flexible for customization
Well integrated with CI ecosystem (Ant, Maven, Ivy, CI
server)
Allow User / 3Party tools to configure, extend and
customize the build process
Tooling API for IDE integration
...
GRADLE IN A NUTSHELLGRADLE IN A NUTSHELL
apply plugin:'java'
version = file("version.txt").text
task helloWorld << {
println "Hello World - version '$version'!"
}
THE ANDROID GRADLE PLUGINTHE ANDROID GRADLE PLUGIN
MINIMAL ANDROID BUILDMINIMAL ANDROID BUILD
plugins {
id 'com.android.application' version '1.1.+'
}
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
}
>gradle check assemble
>gradle build
THE ANDROID GRADLE PLUGINTHE ANDROID GRADLE PLUGIN
BASIC BUILD CUSTOMIZATIONBASIC BUILD CUSTOMIZATION
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
versionCode 12
versionName "2.0"
minSdkVersion 19
targetSdkVersion 22
multiDexEnabled = true
}
}
THE ANDROID GRADLE PLUGINTHE ANDROID GRADLE PLUGIN
REMEMBER, IT'S GROOVY!REMEMBER, IT'S GROOVY!
def calculateVersionName() {
...
}
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
versionName calculateVersionName()
}
}
BUILD TYPESBUILD TYPES
"controls how an app is built"
Customize app parameters
debuggable flag
native debug compilation flag
package suffix
debug signing
proguard options
2 default types (debug + release)
Source code + resources overlay
Custom dependencies
PRODUCT FLAVORSPRODUCT FLAVORS
"a way to generate several versions of the same app"
Customize app parameters
package name
min/targetSdkVersion
versionCodeName
signing info
Source code + resources overlay
Custom dependencies
BUILD VARIANTSBUILD VARIANTS
"a variant is always a flavor + a type"
debug release
free free-debug free-release
payed payed-debug payed-release
BUILD VARIANTS IIBUILD VARIANTS II
PRODUCT FLAVOR GROUPSPRODUCT FLAVOR GROUPS
debug release
free x86 free-x86-debug free-x86-release
ARM free-ARM-debug free-ARM-release
payed x86 payed-x86-debug payed-x86-release
ARM payed-ARM-debug payed-ARM-release
FLAVOR GROUPSFLAVOR GROUPS
flavorDimensions "group1", "group2"
productFlavors {
arm {
flavorDimension "group1"
}
x86 {
flavorDimension "group1"
}
free {
flavorDimension "group2"
}
pro {
flavorDimension "group2"
}
}
SOURCE CODE + RESOURCES OVERLAYSOURCE CODE + RESOURCES OVERLAY
~/dev/androidApp/src>tree
|____main
| |____java
| |____res
|____androidTest
| |____java
| |____res
|____free
| |____java
| |____res
|____debug
| |____java
~/dev/androidApp/src>
Build Type > Product Flavor > main
DEMO IDEMO I
VARIANTS IN ACTIONVARIANTS IN ACTION
BUILD CUSTOMIZATION IBUILD CUSTOMIZATION I
DEX CONFIGURATIONDEX CONFIGURATION
android {
dexOptions {
incremental true
preDexLibraries = false
jumboMode = false
}
}
BUILD CUSTOMIZATION IIBUILD CUSTOMIZATION II
AAPT CONFIGURATIONAAPT CONFIGURATION
android {
aaptOptions {
noCompress 'foo', 'bar'
ignoreAssetsPattern "!.svn:!.git:!.ds_store:!*.scc"
}
}
BUILD CUSTOMIZATION IIIBUILD CUSTOMIZATION III
AND MOREAND MORE
lint
java compile options
proguard
DEMO IIDEMO II
MANIPULATING TASKSMANIPULATING TASKS
TESTINGTESTING
no separate test project needed
variant aware tests
run against (all) connected devices
experimental unit test support (android build tools 1.1)
android {
// ...
testOptions {
unitTests.returnDefaultValues = true
}
}
PLENTY OF MORE THINGSPLENTY OF MORE THINGS
android libraries (aar)
vivid plugin ecosystem
crashlytics
roboelectrics
testfairy
instabug
...
UNDER CONSTRUCTIONUNDER CONSTRUCTION
NDK support
variant aware dependency management
significant performance improvements
LINKS AND POINTERSLINKS AND POINTERS
http://tools.android.com/tech-docs/new-build-
system/user-guide
https://groups.google.com/forum/#!forum/adt-dev
gradle.org
gradleware.com
https://github.com/breskeby/android-demo-app
Q&AQ&A
¡MUCHAS¡MUCHAS
GRACIAS!GRACIAS!
! @breskeby
" github.com/breskeby
# rene.groeschke@gradleware.com

Más contenido relacionado

La actualidad más candente

Android studio&Gradle&Autotest
Android studio&Gradle&AutotestAndroid studio&Gradle&Autotest
Android studio&Gradle&Autotest
毅 方
 

La actualidad más candente (20)

OpenShift: Devops Made Easy
OpenShift: Devops Made EasyOpenShift: Devops Made Easy
OpenShift: Devops Made Easy
 
Android 101 - Introduction to Android Development
Android 101 - Introduction to Android DevelopmentAndroid 101 - Introduction to Android Development
Android 101 - Introduction to Android Development
 
Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...
Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...
Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...
 
Xiaojing_Gong
Xiaojing_GongXiaojing_Gong
Xiaojing_Gong
 
CASCON 2017 - OpenAPI v3
CASCON 2017 - OpenAPI v3CASCON 2017 - OpenAPI v3
CASCON 2017 - OpenAPI v3
 
Nextcloud Android Development Process
Nextcloud Android Development ProcessNextcloud Android Development Process
Nextcloud Android Development Process
 
Exploring the GitHub Service Universe
Exploring the GitHub Service UniverseExploring the GitHub Service Universe
Exploring the GitHub Service Universe
 
Android
AndroidAndroid
Android
 
Android studio&Gradle&Autotest
Android studio&Gradle&AutotestAndroid studio&Gradle&Autotest
Android studio&Gradle&Autotest
 
Introduction of Android Architecture
Introduction of Android ArchitectureIntroduction of Android Architecture
Introduction of Android Architecture
 
An Introduction to Eclipse Che - Next-Gen Eclipse Java IDE
An Introduction to Eclipse Che - Next-Gen Eclipse Java IDEAn Introduction to Eclipse Che - Next-Gen Eclipse Java IDE
An Introduction to Eclipse Che - Next-Gen Eclipse Java IDE
 
Eclipse Che : ParisJUG
Eclipse Che : ParisJUGEclipse Che : ParisJUG
Eclipse Che : ParisJUG
 
Introduction to Eclipse Che / EclipseCon 2014
Introduction to Eclipse Che / EclipseCon 2014Introduction to Eclipse Che / EclipseCon 2014
Introduction to Eclipse Che / EclipseCon 2014
 
Professional iOS development
Professional iOS developmentProfessional iOS development
Professional iOS development
 
NASA Space Apps
NASA Space AppsNASA Space Apps
NASA Space Apps
 
Auckland Docker Meetup (July 2015) - DockerCon2015 lightningtalk
Auckland Docker Meetup (July 2015) - DockerCon2015 lightningtalkAuckland Docker Meetup (July 2015) - DockerCon2015 lightningtalk
Auckland Docker Meetup (July 2015) - DockerCon2015 lightningtalk
 
Automating the Quality
Automating the QualityAutomating the Quality
Automating the Quality
 
NASA Space Apps Expo
NASA Space Apps ExpoNASA Space Apps Expo
NASA Space Apps Expo
 
Eclipse Che - A Revolutionary IDE for Distributed & Mainframe Development
Eclipse Che - A Revolutionary IDE for Distributed & Mainframe DevelopmentEclipse Che - A Revolutionary IDE for Distributed & Mainframe Development
Eclipse Che - A Revolutionary IDE for Distributed & Mainframe Development
 
Arduino - Android Workshop Presentation
Arduino - Android Workshop PresentationArduino - Android Workshop Presentation
Arduino - Android Workshop Presentation
 

Similar a Building android apps with Gradle (GREACH 2015)

WSO2Con US 2013 - Keynote: Developing Enterprise Apps In the Cloud
WSO2Con US 2013 - Keynote: Developing Enterprise Apps In the CloudWSO2Con US 2013 - Keynote: Developing Enterprise Apps In the Cloud
WSO2Con US 2013 - Keynote: Developing Enterprise Apps In the Cloud
WSO2
 
Android 110521210945-phpapp01
Android 110521210945-phpapp01Android 110521210945-phpapp01
Android 110521210945-phpapp01
Mona AlRekabi
 

Similar a Building android apps with Gradle (GREACH 2015) (20)

lecture-2-android-dev.pdf
lecture-2-android-dev.pdflecture-2-android-dev.pdf
lecture-2-android-dev.pdf
 
Android
Android Android
Android
 
Android Studio簡介
Android Studio簡介Android Studio簡介
Android Studio簡介
 
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
 
Accessing Hardware on Android
Accessing Hardware on AndroidAccessing Hardware on Android
Accessing Hardware on Android
 
Student Developer Kit for Developing Applications
Student Developer Kit for Developing ApplicationsStudent Developer Kit for Developing Applications
Student Developer Kit for Developing Applications
 
SynapseIndia mobile apps deployment framework architecture
SynapseIndia mobile apps deployment framework architectureSynapseIndia mobile apps deployment framework architecture
SynapseIndia mobile apps deployment framework architecture
 
Gradle-based Android Build System
Gradle-based Android Build SystemGradle-based Android Build System
Gradle-based Android Build System
 
Arm
ArmArm
Arm
 
AWS Summit Singapore 2019 | Latest Trends for Cloud-Native Application Develo...
AWS Summit Singapore 2019 | Latest Trends for Cloud-Native Application Develo...AWS Summit Singapore 2019 | Latest Trends for Cloud-Native Application Develo...
AWS Summit Singapore 2019 | Latest Trends for Cloud-Native Application Develo...
 
WSO2Con US 2013 - Keynote: Developing Enterprise Apps In the Cloud
WSO2Con US 2013 - Keynote: Developing Enterprise Apps In the CloudWSO2Con US 2013 - Keynote: Developing Enterprise Apps In the Cloud
WSO2Con US 2013 - Keynote: Developing Enterprise Apps In the Cloud
 
Dockercon 2018 EU Updates
Dockercon 2018 EU Updates Dockercon 2018 EU Updates
Dockercon 2018 EU Updates
 
Gerrit linuxtag2011
Gerrit linuxtag2011Gerrit linuxtag2011
Gerrit linuxtag2011
 
PowerShell Inside Out: Applied .NET Hacking for Enhanced Visibility by Satosh...
PowerShell Inside Out: Applied .NET Hacking for Enhanced Visibility by Satosh...PowerShell Inside Out: Applied .NET Hacking for Enhanced Visibility by Satosh...
PowerShell Inside Out: Applied .NET Hacking for Enhanced Visibility by Satosh...
 
Microsoft Tech Summit Switzerland 2019 - DOCKER + AZURE DEVOPS + KUBERNETES = ♥
Microsoft Tech Summit Switzerland 2019 - DOCKER + AZURE DEVOPS + KUBERNETES = ♥Microsoft Tech Summit Switzerland 2019 - DOCKER + AZURE DEVOPS + KUBERNETES = ♥
Microsoft Tech Summit Switzerland 2019 - DOCKER + AZURE DEVOPS + KUBERNETES = ♥
 
Android 110521210945-phpapp01
Android 110521210945-phpapp01Android 110521210945-phpapp01
Android 110521210945-phpapp01
 
Demystifying Docker101
Demystifying Docker101Demystifying Docker101
Demystifying Docker101
 
Demystifying Docker
Demystifying DockerDemystifying Docker
Demystifying Docker
 
Getting started with the NDK
Getting started with the NDKGetting started with the NDK
Getting started with the NDK
 
ANODE – Continuous Deployment with Node.js over Azure, Yosef Dinerstein
ANODE – Continuous Deployment with Node.js over Azure, Yosef DinersteinANODE – Continuous Deployment with Node.js over Azure, Yosef Dinerstein
ANODE – Continuous Deployment with Node.js over Azure, Yosef Dinerstein
 

Último

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Último (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 

Building android apps with Gradle (GREACH 2015)

  • 1.
  • 2. BUILDING ANDROID APPSBUILDING ANDROID APPS WITH GRADLEWITH GRADLE GREACH 2015, Madrid René Gröschke Principal Engineer Gradleware
  • 3. INTRO, DEMO & FORECASTINTRO, DEMO & FORECAST
  • 4. WHY A NEW BUILDWHY A NEW BUILD SYSTEM?SYSTEM?
  • 5. GRADLE 2.3GRADLE 2.3 RELEASED 16TH FEBRUARY 2015RELEASED 16TH FEBRUARY 2015
  • 6. OLD ANDROID BUILDSOLD ANDROID BUILDS Two (official) build mechanism ADT (Eclipse based) Ant Maven Customization? Nothing in ADT Manually hacking xml in ant scripts
  • 7. REQUIREMENTS OF THEREQUIREMENTS OF THE NEW BUILD SYSTEMNEW BUILD SYSTEM Use same system for CommandLine CI Server IDE Support for application/library variants Dependency Management Provide a plugin ecosystem
  • 8. WHY GRADLEWHY GRADLE Allows custom DSL to express build logic Very flexible for customization Well integrated with CI ecosystem (Ant, Maven, Ivy, CI server) Allow User / 3Party tools to configure, extend and customize the build process Tooling API for IDE integration ...
  • 9. GRADLE IN A NUTSHELLGRADLE IN A NUTSHELL apply plugin:'java' version = file("version.txt").text task helloWorld << { println "Hello World - version '$version'!" }
  • 10. THE ANDROID GRADLE PLUGINTHE ANDROID GRADLE PLUGIN MINIMAL ANDROID BUILDMINIMAL ANDROID BUILD plugins { id 'com.android.application' version '1.1.+' } android { compileSdkVersion 22 buildToolsVersion '22.0.1' } >gradle check assemble >gradle build
  • 11. THE ANDROID GRADLE PLUGINTHE ANDROID GRADLE PLUGIN BASIC BUILD CUSTOMIZATIONBASIC BUILD CUSTOMIZATION android { compileSdkVersion 22 buildToolsVersion '22.0.1' defaultConfig { versionCode 12 versionName "2.0" minSdkVersion 19 targetSdkVersion 22 multiDexEnabled = true } }
  • 12. THE ANDROID GRADLE PLUGINTHE ANDROID GRADLE PLUGIN REMEMBER, IT'S GROOVY!REMEMBER, IT'S GROOVY! def calculateVersionName() { ... } android { compileSdkVersion 22 buildToolsVersion '22.0.1' defaultConfig { versionName calculateVersionName() } }
  • 13. BUILD TYPESBUILD TYPES "controls how an app is built" Customize app parameters debuggable flag native debug compilation flag package suffix debug signing proguard options 2 default types (debug + release) Source code + resources overlay Custom dependencies
  • 14. PRODUCT FLAVORSPRODUCT FLAVORS "a way to generate several versions of the same app" Customize app parameters package name min/targetSdkVersion versionCodeName signing info Source code + resources overlay Custom dependencies
  • 15. BUILD VARIANTSBUILD VARIANTS "a variant is always a flavor + a type" debug release free free-debug free-release payed payed-debug payed-release
  • 16. BUILD VARIANTS IIBUILD VARIANTS II PRODUCT FLAVOR GROUPSPRODUCT FLAVOR GROUPS debug release free x86 free-x86-debug free-x86-release ARM free-ARM-debug free-ARM-release payed x86 payed-x86-debug payed-x86-release ARM payed-ARM-debug payed-ARM-release
  • 17. FLAVOR GROUPSFLAVOR GROUPS flavorDimensions "group1", "group2" productFlavors { arm { flavorDimension "group1" } x86 { flavorDimension "group1" } free { flavorDimension "group2" } pro { flavorDimension "group2" } }
  • 18. SOURCE CODE + RESOURCES OVERLAYSOURCE CODE + RESOURCES OVERLAY ~/dev/androidApp/src>tree |____main | |____java | |____res |____androidTest | |____java | |____res |____free | |____java | |____res |____debug | |____java ~/dev/androidApp/src> Build Type > Product Flavor > main
  • 19. DEMO IDEMO I VARIANTS IN ACTIONVARIANTS IN ACTION
  • 20. BUILD CUSTOMIZATION IBUILD CUSTOMIZATION I DEX CONFIGURATIONDEX CONFIGURATION android { dexOptions { incremental true preDexLibraries = false jumboMode = false } }
  • 21. BUILD CUSTOMIZATION IIBUILD CUSTOMIZATION II AAPT CONFIGURATIONAAPT CONFIGURATION android { aaptOptions { noCompress 'foo', 'bar' ignoreAssetsPattern "!.svn:!.git:!.ds_store:!*.scc" } }
  • 22. BUILD CUSTOMIZATION IIIBUILD CUSTOMIZATION III AND MOREAND MORE lint java compile options proguard
  • 23. DEMO IIDEMO II MANIPULATING TASKSMANIPULATING TASKS
  • 24. TESTINGTESTING no separate test project needed variant aware tests run against (all) connected devices experimental unit test support (android build tools 1.1) android { // ... testOptions { unitTests.returnDefaultValues = true } }
  • 25. PLENTY OF MORE THINGSPLENTY OF MORE THINGS android libraries (aar) vivid plugin ecosystem crashlytics roboelectrics testfairy instabug ...
  • 26. UNDER CONSTRUCTIONUNDER CONSTRUCTION NDK support variant aware dependency management significant performance improvements
  • 27. LINKS AND POINTERSLINKS AND POINTERS http://tools.android.com/tech-docs/new-build- system/user-guide https://groups.google.com/forum/#!forum/adt-dev gradle.org gradleware.com https://github.com/breskeby/android-demo-app
  • 29.