SlideShare a Scribd company logo
Gradle & Android Studio
An introduction
drivr.com
@drivr

FIRSTDRIVR
Schedule
●
●
●
●
●
●

Why Gradle?
Converting an existing project
Build types and product flavors
Custom tasks
Testing
Continuous integration
Why Gradle?
Pros
● Not Ant
● Groovy-based
● Gradle wrapper
● Multi-project builds
● Dependency management
Cons
● Slower than Ant
● Documentation
● Android plugin under development
● Dependency management
Demo - New project
Convert a project
How to convert
● Project structure
● Gradle wrapper
● Dependencies
Good resource:
http://ryanharter.com/blog/2013/07/17/migrating-android-projects-to-gradle
Types & flavors
Build types
● E.g. debug, staging, production
● Separate packages
● Different resources
Build types - Example
buildTypes {
staging {
packageNameSuffix ".staging"
versionNameSuffix "-staging"
signingConfig signingConfigs.staging
}
}
Build types - Example
signingConfigs {
staging {
storeFile file("staging.keystore")
storePassword "storepwd"
keyAlias "alias"
keyPassword "keypwd"
}
}
Build types - Example
module
src
staging
java
res
AndroidManifest.xml
Product flavors
● E.g. free, pro
● Multi APK (e.g. <= 2.2 & > 2.2)
● Combination
Setup: same as build types
Build variants
Build type + Product flavor = Build variant
● Pro Debug & Free Debug
● Pro Staging & Free Staging
● ...
Custom tasks
Custom tasks - Example
task keyStorePassword << {
def keystorePw = new String(
System.console().readPassword
("Password?"))
android.signingConfigs.release
.storePassword = keystorePw
}
Custom tasks - Example
tasks.whenTaskAdded { task ->
if (task.name.equals("packageRelease")) {
task.dependsOn "keyStorePassword"
}
}
Testing
Instrumentation tests
● No separate project
○ srcinstrumentTest

● Own dependencies
○ dependencies { instrumentTestCompile x
}

● gradlew connectedInstrumentTest
Unit tests (JUnit & Robolectric)
● No official support
● Add custom task
● Some hacking required
Continuous integration
CI with Jenkins
● Android SDK on build server
● Gradle plugin - “Invoke Gradle script”
● Emulator support
Good resource:
http://blog.zuehlke.com/configure-your-android-project-on-jenkins/
Want to get started?
Resources
http://tools.android.com/tech-docs/new-build-system/user-guide
http://www.gradle.org/documentation
https://plus.google.com/+AndroidDevelopers/posts
https://gradleplease.appspot.com

DuckDuckGo / Google
Contact me
@kevinpelgrims

http://kevinpelgrims.com/blog

More Related Content

What's hot (20)

PDF
[Ultracode Munich #4] Short introduction to the new Android build system incl...
BeMyApp
 
PPTX
Project a day 2 introduction to android studio
Goran Djonovic
 
PDF
Gradle enabled android project
Shaka Huang
 
PPTX
Creating the first app with android studio
Parinita03
 
PDF
Android Studio vs. ADT
Dominik Helleberg
 
PDF
Latest & interesting updates #android dev
Paresh Mayani
 
PPTX
Android development session 5 - Debug android studio
Farabi Technology Middle East
 
PPTX
Exploring the power of Gradle in android studio - Basics & Beyond
Kaushal Dhruw
 
PDF
A/B test your Android build setup with ASPoet
Boris Farber
 
PPT
Getting Started with Android
joshdobbs
 
PDF
Intro to Flutter
Eason Pai
 
PDF
Study Jam: Android for Beginners, Summary
Constantine Mars
 
PDF
Porting golang development environment developed with golang
SeongJae Park
 
PDF
Flutter tutorial for Beginner Step by Step
Chandramouli Biyyala
 
PPTX
Golang start and tips
Aaron King
 
PDF
#Code2Create:: Introduction to App Development in Flutter with Dart
GDGKuwaitGoogleDevel
 
PDF
(Live) build and run golang web server on android.avi
SeongJae Park
 
PDF
Developing cross platform apps in Flutter (Android, iOS, and Web)
Priyanka Tyagi
 
PDF
Develop Android app using Golang
SeongJae Park
 
PPTX
Intro to Flutter SDK
digitaljoni
 
[Ultracode Munich #4] Short introduction to the new Android build system incl...
BeMyApp
 
Project a day 2 introduction to android studio
Goran Djonovic
 
Gradle enabled android project
Shaka Huang
 
Creating the first app with android studio
Parinita03
 
Android Studio vs. ADT
Dominik Helleberg
 
Latest & interesting updates #android dev
Paresh Mayani
 
Android development session 5 - Debug android studio
Farabi Technology Middle East
 
Exploring the power of Gradle in android studio - Basics & Beyond
Kaushal Dhruw
 
A/B test your Android build setup with ASPoet
Boris Farber
 
Getting Started with Android
joshdobbs
 
Intro to Flutter
Eason Pai
 
Study Jam: Android for Beginners, Summary
Constantine Mars
 
Porting golang development environment developed with golang
SeongJae Park
 
Flutter tutorial for Beginner Step by Step
Chandramouli Biyyala
 
Golang start and tips
Aaron King
 
#Code2Create:: Introduction to App Development in Flutter with Dart
GDGKuwaitGoogleDevel
 
(Live) build and run golang web server on android.avi
SeongJae Park
 
Developing cross platform apps in Flutter (Android, iOS, and Web)
Priyanka Tyagi
 
Develop Android app using Golang
SeongJae Park
 
Intro to Flutter SDK
digitaljoni
 

Viewers also liked (20)

PDF
Gradle Introduction
Dmitry Buzdin
 
PDF
Gradle for Android Developers
Josiah Renaudin
 
PDF
Android gradle-build-system-overview
Kevin He
 
PDF
Android activities & views
ma-polimi
 
PDF
Android Fundamentals
Mohammad Tarek
 
PPTX
Android app fundamentals
Amr Salman
 
PDF
Android Fundamentals - Day 2
Mohammad Tarek
 
PPTX
What’s new for Android Developers in 2015 - Material Design, Android Studio, ...
Deepu S Nath
 
PPTX
Android Application Fundamentals
Vikalp Jain
 
PDF
Android Fundamentals
YAMANE Toshiaki
 
PDF
AndroidManifest
Ahsanul Karim
 
PDF
A Deep Dive into Open Source Android Development
David Wu
 
PPTX
Gradle,the new build system for android
zhang ghui
 
PPTX
The Journey to conversational interfaces
Romin Irani
 
PDF
Intents in Android
ma-polimi
 
PPTX
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Ahsanul Karim
 
PPT
Day 4: Android: UI Widgets
Ahsanul Karim
 
PDF
How to improve gradle build speed
Fate Chang
 
PDF
Android: Intent, Intent Filter, Broadcast Receivers
CodeAndroid
 
PDF
Lecture 5: Storage: Saving Data Database, Files & Preferences
Ahsanul Karim
 
Gradle Introduction
Dmitry Buzdin
 
Gradle for Android Developers
Josiah Renaudin
 
Android gradle-build-system-overview
Kevin He
 
Android activities & views
ma-polimi
 
Android Fundamentals
Mohammad Tarek
 
Android app fundamentals
Amr Salman
 
Android Fundamentals - Day 2
Mohammad Tarek
 
What’s new for Android Developers in 2015 - Material Design, Android Studio, ...
Deepu S Nath
 
Android Application Fundamentals
Vikalp Jain
 
Android Fundamentals
YAMANE Toshiaki
 
AndroidManifest
Ahsanul Karim
 
A Deep Dive into Open Source Android Development
David Wu
 
Gradle,the new build system for android
zhang ghui
 
The Journey to conversational interfaces
Romin Irani
 
Intents in Android
ma-polimi
 
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Ahsanul Karim
 
Day 4: Android: UI Widgets
Ahsanul Karim
 
How to improve gradle build speed
Fate Chang
 
Android: Intent, Intent Filter, Broadcast Receivers
CodeAndroid
 
Lecture 5: Storage: Saving Data Database, Files & Preferences
Ahsanul Karim
 
Ad

Similar to Gradle & Android Studio - Introduction (18)

PPTX
Android
Sai Kiran
 
PDF
Gradle-based Android Build System
moallemi
 
PDF
A Gradle Story
Eduardo Felipe Ewert Bonet
 
PDF
Gradle and Your Android Wearable Projects
CommonsWare
 
PPTX
Day2GDSC.pptx
GDSCICOER
 
PPTX
Kotlin Basics & Introduction to Jetpack Compose.pptx
takshilkunadia
 
PDF
Android studio
Željko Plesac
 
PDF
Head first android apps dev tools
Shaka Huang
 
PPTX
Gradle build capabilities
Zeinab Mohamed Abdelmawla
 
PPTX
Build your android app with gradle
Swain Loda
 
PPTX
Android studio&Gradle&Autotest
毅 方
 
PDF
Gradle 101
Kurt Mbanje
 
PPTX
Getting started with android development
FatimaYousif11
 
PPTX
Gradle 2.breaking stereotypes.
Stfalcon Meetups
 
PDF
Android workshop series
PranjaliJadkar
 
PDF
Next Step, Android Studio!
Édipo Souza
 
PDF
Emergency androidstudiochapter
Aravindharamanan S
 
PDF
Szczepan.faber.gradle
magda3695
 
Android
Sai Kiran
 
Gradle-based Android Build System
moallemi
 
Gradle and Your Android Wearable Projects
CommonsWare
 
Day2GDSC.pptx
GDSCICOER
 
Kotlin Basics & Introduction to Jetpack Compose.pptx
takshilkunadia
 
Android studio
Željko Plesac
 
Head first android apps dev tools
Shaka Huang
 
Gradle build capabilities
Zeinab Mohamed Abdelmawla
 
Build your android app with gradle
Swain Loda
 
Android studio&Gradle&Autotest
毅 方
 
Gradle 101
Kurt Mbanje
 
Getting started with android development
FatimaYousif11
 
Gradle 2.breaking stereotypes.
Stfalcon Meetups
 
Android workshop series
PranjaliJadkar
 
Next Step, Android Studio!
Édipo Souza
 
Emergency androidstudiochapter
Aravindharamanan S
 
Szczepan.faber.gradle
magda3695
 
Ad

Recently uploaded (20)

PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PDF
Per Axbom: The spectacular lies of maps
Nexer Digital
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PPTX
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
Per Axbom: The spectacular lies of maps
Nexer Digital
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 

Gradle & Android Studio - Introduction