SlideShare a Scribd company logo
1 of 29
Download to read offline
Building with Gradle 101
Kurt Mbanje : DStv Digital Media
+KurtMbanje
@ckurtm
What is Gradle?
Why Gradle?
Background: Android Build Process
Why Gradle?
• Declarative vs Imperative
• Flexibility & Customization
• “Convention over Configuration” , well
…convention is good but so is flexibility
Declarative vs Imperative
• Imperative : script how to do something, and as a
result what you want to happen will happen
• Declarative: script what you would like to happen,
and let the tool figure out how to do it
Declarative vs Imperative
• Imperative : script how to do something, and as a
result what you want to happen will happen
• Declarative: script what you would like to happen,
and let the tool figure out how to do it
Flexibility & Customization
• Supports Android’s diverse ecosystem, e.g. ABI,
density , API level etc.
• Split apks for Play Store
• Still allows you to write plugins and tasks
Flexibility & Customization
• Supports Android’s diverse ecosystem, e.g. ABI,
density , API level etc.
• Split apks for Play Store
• Still allows you to write plugins and tasks
Flexibility & Customization
• Supports Android’s diverse ecosystem, e.g. ABI,
density , API level etc.
• Split apks for Play Store
• Still allows you to write plugins and tasks
Convention over Configuration ++
Android Gradle Concepts
• Build Types - how the application is packaged, and how the
compiler is called (mostly)
Debug vs Release (vs. <other>)
• Product Flavors – mostly has to do with features
paid vs. free
abi packaging
• Variants = Build Types + Flavors
freeDebug , paidRelease , paidDebug , freeRelease
Android Gradle Concepts
• Build Types - how the application is packaged, and how the
compiler is called (mostly)
Debug vs Release (vs. <other>)
• Product Flavors – mostly has to do with features
paid vs. free
abi packaging
• Variants = Build Types + Flavors
freeDebug , paidRelease , paidDebug , freeRelease
Android Gradle Concepts
• Build Types - how the application is packaged, and how the
compiler is called (mostly)
Debug vs Release (vs. <other>)
• Product Flavors – mostly has to do with features
paid vs. free
abi packaging
• Variants = Build Types + Flavors
freeDebug , paidRelease , paidDebug , freeRelease
Sample Android build script: build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.0'
}
Build Script: Repositories & Android Plugin
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
Android Plugin
apply plugin: 'com.android.application'
Compile SDK & Tools Version
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
Example: Build Types
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
applicationIdSuffix '.debug'
versionNameSuffix '.debug'
}
}
Default Config
defaultConfig {
applicationId "com.example.test"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
Flavors
Build Variants
• Variants = Build Types + Flavors
freeDebug , paidRelease , paidDebug , freeRelease
Debug Release
Free freeDebug freeRelease
Paid paidDebug paidRelease
• Flavor Groups /Dimensions
adds another 3rd matrix to the mix… or 4th
Dependencies
• Local file
Jar or aar file
• Remote / Local repositories
JCenter, maven , custom etc.
Tip 1: View app dependencies
./gradlew :app:dependencies
./gradlew :app:androidDependencies
Tip 2: Use Gradle wrapper!
./gradle wrapper --gradle-version 2.0
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
Tip 3: Gradle GUI
./gradle --gui
Tip 4: Different Icon per BuildType
Tip 5: BuildConfig.java
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.peirr.test.debug";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0.debug";
}
Thanks
https://docs.gradle.org/current/userguide/gradle_wrapper.html
https://github.com/ckurtm/Gradle101
http://tools.android.com/tech-docs/new-build-system

More Related Content

What's hot

Pragmatic software development in kdb+
Pragmatic software development in kdb+Pragmatic software development in kdb+
Pragmatic software development in kdb+Ajay Rathore
 
Angry Developer: Creating a Game in QML and JavaScript for MeeGo N9 @iRajLal
Angry Developer: Creating a Game in QML and JavaScript for MeeGo N9 @iRajLalAngry Developer: Creating a Game in QML and JavaScript for MeeGo N9 @iRajLal
Angry Developer: Creating a Game in QML and JavaScript for MeeGo N9 @iRajLalRaj Lal
 
Docker Best Practices Workshop
Docker Best Practices WorkshopDocker Best Practices Workshop
Docker Best Practices WorkshopAhmed AbouZaid
 
Building Translate on Glass
Building Translate on GlassBuilding Translate on Glass
Building Translate on GlassTrish Whetzel
 
Microservices in Golang
Microservices in GolangMicroservices in Golang
Microservices in GolangMo'ath Qasim
 
Continuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CIContinuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CIalexanderkiel
 
VM vs Docker-Based Pipelines
VM vs Docker-Based PipelinesVM vs Docker-Based Pipelines
VM vs Docker-Based PipelinesCodefresh
 
CI/CD with Openshift and Jenkins
CI/CD with Openshift and JenkinsCI/CD with Openshift and Jenkins
CI/CD with Openshift and JenkinsAri LiVigni
 
Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!Milindu Sanoj Kumarage
 
Docker based-Pipelines with Codefresh
Docker based-Pipelines with CodefreshDocker based-Pipelines with Codefresh
Docker based-Pipelines with CodefreshCodefresh
 
13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applicationsKarthik Gaekwad
 
Infinum Android Talks #14 - Gradle plugins
Infinum Android Talks #14 - Gradle pluginsInfinum Android Talks #14 - Gradle plugins
Infinum Android Talks #14 - Gradle pluginsInfinum
 
Introduction to Kubernetes - Docker Global Mentor Week 2016
Introduction to Kubernetes - Docker Global Mentor Week 2016Introduction to Kubernetes - Docker Global Mentor Week 2016
Introduction to Kubernetes - Docker Global Mentor Week 2016Opsta
 
GitLab for CI/CD process
GitLab for CI/CD processGitLab for CI/CD process
GitLab for CI/CD processHYS Enterprise
 
GWTcon 2015 - Best development practices for GWT web applications
GWTcon 2015 - Best development practices for GWT web applications GWTcon 2015 - Best development practices for GWT web applications
GWTcon 2015 - Best development practices for GWT web applications Arcbees
 

What's hot (20)

Gradle
GradleGradle
Gradle
 
Pragmatic software development in kdb+
Pragmatic software development in kdb+Pragmatic software development in kdb+
Pragmatic software development in kdb+
 
Angry Developer: Creating a Game in QML and JavaScript for MeeGo N9 @iRajLal
Angry Developer: Creating a Game in QML and JavaScript for MeeGo N9 @iRajLalAngry Developer: Creating a Game in QML and JavaScript for MeeGo N9 @iRajLal
Angry Developer: Creating a Game in QML and JavaScript for MeeGo N9 @iRajLal
 
Docker Best Practices Workshop
Docker Best Practices WorkshopDocker Best Practices Workshop
Docker Best Practices Workshop
 
Building Translate on Glass
Building Translate on GlassBuilding Translate on Glass
Building Translate on Glass
 
Microservices in Golang
Microservices in GolangMicroservices in Golang
Microservices in Golang
 
Continuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CIContinuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CI
 
VM vs Docker-Based Pipelines
VM vs Docker-Based PipelinesVM vs Docker-Based Pipelines
VM vs Docker-Based Pipelines
 
Deep dive into serverless on Google Cloud
Deep dive into serverless on Google CloudDeep dive into serverless on Google Cloud
Deep dive into serverless on Google Cloud
 
CI/CD with Openshift and Jenkins
CI/CD with Openshift and JenkinsCI/CD with Openshift and Jenkins
CI/CD with Openshift and Jenkins
 
Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!
 
Introduction To Grails
Introduction To GrailsIntroduction To Grails
Introduction To Grails
 
Docker based-Pipelines with Codefresh
Docker based-Pipelines with CodefreshDocker based-Pipelines with Codefresh
Docker based-Pipelines with Codefresh
 
Introduction to chef
Introduction to chefIntroduction to chef
Introduction to chef
 
13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications
 
Infinum Android Talks #14 - Gradle plugins
Infinum Android Talks #14 - Gradle pluginsInfinum Android Talks #14 - Gradle plugins
Infinum Android Talks #14 - Gradle plugins
 
Introduction to Kubernetes - Docker Global Mentor Week 2016
Introduction to Kubernetes - Docker Global Mentor Week 2016Introduction to Kubernetes - Docker Global Mentor Week 2016
Introduction to Kubernetes - Docker Global Mentor Week 2016
 
GitLab for CI/CD process
GitLab for CI/CD processGitLab for CI/CD process
GitLab for CI/CD process
 
GWTcon 2015 - Best development practices for GWT web applications
GWTcon 2015 - Best development practices for GWT web applications GWTcon 2015 - Best development practices for GWT web applications
GWTcon 2015 - Best development practices for GWT web applications
 
Real time web
Real time webReal time web
Real time web
 

Similar to Gradle 101

Android Studio 3 - Dependency-Aware Build Variants and Product Flavors
Android Studio 3 - Dependency-Aware Build Variants and Product FlavorsAndroid Studio 3 - Dependency-Aware Build Variants and Product Flavors
Android Studio 3 - Dependency-Aware Build Variants and Product FlavorsStefan Martynkiw
 
Exploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondExploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondKaushal Dhruw
 
Gradle enabled android project
Gradle enabled android projectGradle enabled android project
Gradle enabled android projectShaka Huang
 
Angular mobile angular_u
Angular mobile angular_uAngular mobile angular_u
Angular mobile angular_uDoris Chen
 
BDD presentation
BDD presentationBDD presentation
BDD presentationtemebele
 
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)Synerzip
 
Build your android app with gradle
Build your android app with gradleBuild your android app with gradle
Build your android app with gradleSwain Loda
 
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...Alexandr Savchenko
 
"Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa..."Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa...Fwdays
 
Topic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolutionTopic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolutionHoa Le
 
Don't let your tests slow you down
Don't let your tests slow you downDon't let your tests slow you down
Don't let your tests slow you downDaniel Irvine
 
Impact of CD, Clean Code, ... on Team Performance
Impact of CD, Clean Code, ... on Team PerformanceImpact of CD, Clean Code, ... on Team Performance
Impact of CD, Clean Code, ... on Team PerformanceFredrik Wendt
 
Next Step, Android Studio!
Next Step, Android Studio!Next Step, Android Studio!
Next Step, Android Studio!Édipo Souza
 
"Dude, where’s my boilerplate? ", Oleksii Makodzeba
"Dude, where’s my boilerplate? ", Oleksii Makodzeba"Dude, where’s my boilerplate? ", Oleksii Makodzeba
"Dude, where’s my boilerplate? ", Oleksii MakodzebaFwdays
 
Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...
Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...
Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...AgileNetwork
 
Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...
Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...
Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...AgileNetwork
 
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...Dicoding
 
BDD & Beyond: The Past, Present, & Future of Test Automation
BDD & Beyond: The Past, Present, & Future of Test AutomationBDD & Beyond: The Past, Present, & Future of Test Automation
BDD & Beyond: The Past, Present, & Future of Test AutomationFord Prior
 

Similar to Gradle 101 (20)

Android Studio 3 - Dependency-Aware Build Variants and Product Flavors
Android Studio 3 - Dependency-Aware Build Variants and Product FlavorsAndroid Studio 3 - Dependency-Aware Build Variants and Product Flavors
Android Studio 3 - Dependency-Aware Build Variants and Product Flavors
 
Exploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondExploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & Beyond
 
Gradle enabled android project
Gradle enabled android projectGradle enabled android project
Gradle enabled android project
 
Angular mobile angular_u
Angular mobile angular_uAngular mobile angular_u
Angular mobile angular_u
 
BDD presentation
BDD presentationBDD presentation
BDD presentation
 
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
 
Build your android app with gradle
Build your android app with gradleBuild your android app with gradle
Build your android app with gradle
 
Gradle build capabilities
Gradle build capabilities Gradle build capabilities
Gradle build capabilities
 
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
 
"Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa..."Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa...
 
Topic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolutionTopic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolution
 
Don't let your tests slow you down
Don't let your tests slow you downDon't let your tests slow you down
Don't let your tests slow you down
 
Impact of CD, Clean Code, ... on Team Performance
Impact of CD, Clean Code, ... on Team PerformanceImpact of CD, Clean Code, ... on Team Performance
Impact of CD, Clean Code, ... on Team Performance
 
Design Without Types
Design Without TypesDesign Without Types
Design Without Types
 
Next Step, Android Studio!
Next Step, Android Studio!Next Step, Android Studio!
Next Step, Android Studio!
 
"Dude, where’s my boilerplate? ", Oleksii Makodzeba
"Dude, where’s my boilerplate? ", Oleksii Makodzeba"Dude, where’s my boilerplate? ", Oleksii Makodzeba
"Dude, where’s my boilerplate? ", Oleksii Makodzeba
 
Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...
Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...
Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...
 
Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...
Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...
Agile Network India | Experiences in the Implementation of BDD / FDD | Supriy...
 
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...
 
BDD & Beyond: The Past, Present, & Future of Test Automation
BDD & Beyond: The Past, Present, & Future of Test AutomationBDD & Beyond: The Past, Present, & Future of Test Automation
BDD & Beyond: The Past, Present, & Future of Test Automation
 

Recently uploaded

WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
+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
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 

Recently uploaded (20)

WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
+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...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 

Gradle 101

  • 1. Building with Gradle 101 Kurt Mbanje : DStv Digital Media +KurtMbanje @ckurtm
  • 5. Why Gradle? • Declarative vs Imperative • Flexibility & Customization • “Convention over Configuration” , well …convention is good but so is flexibility
  • 6. Declarative vs Imperative • Imperative : script how to do something, and as a result what you want to happen will happen • Declarative: script what you would like to happen, and let the tool figure out how to do it
  • 7. Declarative vs Imperative • Imperative : script how to do something, and as a result what you want to happen will happen • Declarative: script what you would like to happen, and let the tool figure out how to do it
  • 8. Flexibility & Customization • Supports Android’s diverse ecosystem, e.g. ABI, density , API level etc. • Split apks for Play Store • Still allows you to write plugins and tasks
  • 9. Flexibility & Customization • Supports Android’s diverse ecosystem, e.g. ABI, density , API level etc. • Split apks for Play Store • Still allows you to write plugins and tasks
  • 10. Flexibility & Customization • Supports Android’s diverse ecosystem, e.g. ABI, density , API level etc. • Split apks for Play Store • Still allows you to write plugins and tasks
  • 12. Android Gradle Concepts • Build Types - how the application is packaged, and how the compiler is called (mostly) Debug vs Release (vs. <other>) • Product Flavors – mostly has to do with features paid vs. free abi packaging • Variants = Build Types + Flavors freeDebug , paidRelease , paidDebug , freeRelease
  • 13. Android Gradle Concepts • Build Types - how the application is packaged, and how the compiler is called (mostly) Debug vs Release (vs. <other>) • Product Flavors – mostly has to do with features paid vs. free abi packaging • Variants = Build Types + Flavors freeDebug , paidRelease , paidDebug , freeRelease
  • 14. Android Gradle Concepts • Build Types - how the application is packaged, and how the compiler is called (mostly) Debug vs Release (vs. <other>) • Product Flavors – mostly has to do with features paid vs. free abi packaging • Variants = Build Types + Flavors freeDebug , paidRelease , paidDebug , freeRelease
  • 15. Sample Android build script: build.gradle buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.3.0' } } apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.example.test" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.1.0' }
  • 16. Build Script: Repositories & Android Plugin buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.3.0' } }
  • 17. Android Plugin apply plugin: 'com.android.application'
  • 18. Compile SDK & Tools Version android { compileSdkVersion 23 buildToolsVersion "23.0.2"
  • 19. Example: Build Types buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { minifyEnabled true applicationIdSuffix '.debug' versionNameSuffix '.debug' } }
  • 20. Default Config defaultConfig { applicationId "com.example.test" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" }
  • 22. Build Variants • Variants = Build Types + Flavors freeDebug , paidRelease , paidDebug , freeRelease Debug Release Free freeDebug freeRelease Paid paidDebug paidRelease • Flavor Groups /Dimensions adds another 3rd matrix to the mix… or 4th
  • 23. Dependencies • Local file Jar or aar file • Remote / Local repositories JCenter, maven , custom etc.
  • 24. Tip 1: View app dependencies ./gradlew :app:dependencies ./gradlew :app:androidDependencies
  • 25. Tip 2: Use Gradle wrapper! ./gradle wrapper --gradle-version 2.0 task wrapper(type: Wrapper) { gradleVersion = '2.0' }
  • 26. Tip 3: Gradle GUI ./gradle --gui
  • 27. Tip 4: Different Icon per BuildType
  • 28. Tip 5: BuildConfig.java public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.peirr.test.debug"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0.debug"; }