SlideShare a Scribd company logo
Android Studio
Build Variants
About me
Édipo Souza
● Work at GREat/UFC in SeDAn project.
● Édipo Souza has over 3 years experience in android development with degree in
Sistemas e Mídias Digitais by Federal University of Ceará.
● He has certifications Oracle Certified Associate Java SE 8 Programmer and
Microsoft Programming in HTML5 with JavaScript and CSS3 Specialist.
http://www.ediposouza.com
● What’s Build Variant?
● Build Variant Advantages
● How to Use Create
● Build Variant and Build Type
● How to Use It
● References
Schedule
It’s a feature of build system that allows you to create
different versions of same app in a single project.
What’s Build Variant?
● Demo version (incomplete app)
● Free version (full app advertising)
● Pro version (full app without advertising)
● Trial version (full app for a limited time)
● Specific version for devices with physical buttons
What’s Build Variant?
● Centralize and organize all code related to your application
● Avoid code duplication in separate projects
● Facilitate the implementation of maintenance
● Keep all versions always updated
Build Variant Advantages
● For each new version of the app, declare a flavor within item
productFlavors in app build.gradle with a name that define it.
● You can overwrite any existing items in DefaultConfig like
applicationId in example bellow.
productFlavors {
demo {
applicationId "com.ediposouza.app_name.demo"
}
full {
}
}
How to Create
● Create a folder with same flavor name in src directory with
java within it.
● You can also create Assets and res folders with files for this
specific version.
● The variant can also have a Manifest with particular
configuration that will be merged with main Manifest.
How to Create
● Each build variant is a formed with combination of a flavor
and a build type.
● All versions can be builded as debug or release type.
● You can still use BuildConfig.DEBUG boolean value to make
adaptations between test version and production version.
Ex: boolean serverUrl = BuildConfig.DEBUG ? testUrl : prodUrl;
Build Variant and Build
Type
● The classes and resources of active build variant will be
merged with the main files.
● You can’t have a class in any variant with same name of one
in main folder. However between two variant you often have
classes with same name. The same is valid for resources.
● When create a new class or
move an existing one, choose
where it will be saved.
How to Use It
● You can work only with a Build Variant at time and if have
some flavor declared, at lest one have to be active.
● Does make sense to define just one flavor, because you
main files will always be merged with same Variant files.
● To create test classes for a Build Variant, create a folder
androidTest***flavor name***.
● The active variant can be changed
in Build Variant tab and Each module
have it own Build Variants..
How to Use It
Demo
Cool Links:
● http://ediposouza.com/android-studio-build-variant
● https://developer.android.com/tools/building/configuring-gradle.html#workBuildVariants
Questions?
Contato:
edipo2s@gmail.com
www.great.ufc.br
THANKS!!!

More Related Content

Viewers also liked (17)

PDF
Firebase dispensando o uso do tradicional backend parasincronização de dados
Francielly Moraes
 
DOCX
Revolucion 2016 esther
RedvolucionCesarNorte
 
PPTX
Pro Largent Size For Bigger Penis Size: Male Enhancement
tombarnytom
 
PPT
100315 how to be found and find a job on linked in
Keith Conrad AIA | Architect | PM | LEED AP | NCARB
 
PDF
Moodle 2: Best Practices for Course Creators - Ireland and UK Moodlemoot 2012
Michelle Moore
 
PPTX
NATIVE POLLINATOR PRESENTATION FOR ACROSS
Paige Hickman
 
PDF
SearchLove London 2015 | Wil Reynolds | Using Paid Social and Adwords to Dri...
Distilled
 
PPT
Herbal Hair Dye
Dr K SUDHEER KUMAR KANDIBANDA
 
PPTX
New overview of plant virology
WE ARE INDIAN RISERS !
 
PPT
Insect pollinators, their management and role in crop production
RAU, Pusa
 
PPTX
Knol khol by harmanjeet
Student
 
PPTX
Store grain pests A Lecture By Mr Allah Dad Khan
Mr.Allah Dad Khan
 
PPTX
PHYTO-PHARMACEUTICALS..........
Dr K SUDHEER KUMAR KANDIBANDA
 
PPT
Avs trichodrma as a biocontrol agent
AMOL SHITOLE
 
DOCX
Surat pernyataan bersedia dicalonkan menjadi perangkat desa
RaFuzi Diqi
 
PDF
NATURAL PESTICIDES
Dr K SUDHEER KUMAR KANDIBANDA
 
PPT
ENTOMOPATHOGENIC FUNGI
Asst Prof SSNAIK ENTO PJTSAU
 
Firebase dispensando o uso do tradicional backend parasincronização de dados
Francielly Moraes
 
Revolucion 2016 esther
RedvolucionCesarNorte
 
Pro Largent Size For Bigger Penis Size: Male Enhancement
tombarnytom
 
100315 how to be found and find a job on linked in
Keith Conrad AIA | Architect | PM | LEED AP | NCARB
 
Moodle 2: Best Practices for Course Creators - Ireland and UK Moodlemoot 2012
Michelle Moore
 
NATIVE POLLINATOR PRESENTATION FOR ACROSS
Paige Hickman
 
SearchLove London 2015 | Wil Reynolds | Using Paid Social and Adwords to Dri...
Distilled
 
New overview of plant virology
WE ARE INDIAN RISERS !
 
Insect pollinators, their management and role in crop production
RAU, Pusa
 
Knol khol by harmanjeet
Student
 
Store grain pests A Lecture By Mr Allah Dad Khan
Mr.Allah Dad Khan
 
PHYTO-PHARMACEUTICALS..........
Dr K SUDHEER KUMAR KANDIBANDA
 
Avs trichodrma as a biocontrol agent
AMOL SHITOLE
 
Surat pernyataan bersedia dicalonkan menjadi perangkat desa
RaFuzi Diqi
 
NATURAL PESTICIDES
Dr K SUDHEER KUMAR KANDIBANDA
 
ENTOMOPATHOGENIC FUNGI
Asst Prof SSNAIK ENTO PJTSAU
 

Similar to Android studio build variants (17)

PPTX
Android Studio 3 - Dependency-Aware Build Variants and Product Flavors
Stefan Martynkiw
 
PDF
Understanding Android Build Variants
donnfelker
 
PDF
Gradle-based Android Build System
moallemi
 
PPTX
Exploring the power of Gradle in android studio - Basics & Beyond
Kaushal Dhruw
 
PDF
Gradle 101
Kurt Mbanje
 
PPTX
Gradle build capabilities
Zeinab Mohamed Abdelmawla
 
PDF
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
Dicoding
 
PPTX
20160915 automation with_gradle
Yuki Nanri
 
PDF
Building android apps with Gradle (GREACH 2015)
René Gröschke
 
PDF
A Gradle Story
Eduardo Felipe Ewert Bonet
 
PDF
Head first android apps dev tools
Shaka Huang
 
PPTX
Creating the first app with android studio
Parinita03
 
PDF
Michal Havryluk: How To Speed Up Android Gradle Builds
mdevtalk
 
PDF
Android : Deep dive into developing MobileApp using Android
Emertxe Information Technologies Pvt Ltd
 
PDF
Gradle presentation
Oriol Jiménez
 
PDF
3 Tips to Help You Migrate to Android Studio 3.0
SafeDK
 
PDF
Gradle enabled android project
Shaka Huang
 
Android Studio 3 - Dependency-Aware Build Variants and Product Flavors
Stefan Martynkiw
 
Understanding Android Build Variants
donnfelker
 
Gradle-based Android Build System
moallemi
 
Exploring the power of Gradle in android studio - Basics & Beyond
Kaushal Dhruw
 
Gradle 101
Kurt Mbanje
 
Gradle build capabilities
Zeinab Mohamed Abdelmawla
 
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
Dicoding
 
20160915 automation with_gradle
Yuki Nanri
 
Building android apps with Gradle (GREACH 2015)
René Gröschke
 
Head first android apps dev tools
Shaka Huang
 
Creating the first app with android studio
Parinita03
 
Michal Havryluk: How To Speed Up Android Gradle Builds
mdevtalk
 
Android : Deep dive into developing MobileApp using Android
Emertxe Information Technologies Pvt Ltd
 
Gradle presentation
Oriol Jiménez
 
3 Tips to Help You Migrate to Android Studio 3.0
SafeDK
 
Gradle enabled android project
Shaka Huang
 
Ad

More from Édipo Souza (13)

PDF
Estudo comparativo das linguagens kotlin e java no desenvolvimento de aplicac...
Édipo Souza
 
PPTX
Android, Gradle & Dependecies
Édipo Souza
 
PPTX
Testing android apps with espresso
Édipo Souza
 
PDF
Next Step, Android Studio!
Édipo Souza
 
PDF
Introdução a Plataforma Android
Édipo Souza
 
PPTX
Apresentação de minha Monografia do curso de Sistema e Mídias Digitais
Édipo Souza
 
PDF
UMA ANÁLISE COMPARATIVA DE FERRAMENTAS DE DESENVOLVIMENTO MULTIPLATAFORMA PAR...
Édipo Souza
 
PPTX
Android - Frameworks de Testes
Édipo Souza
 
PPTX
Android - Frameworks para Gráficos
Édipo Souza
 
PPTX
Logging Patterns & Anti-Patterns
Édipo Souza
 
PPTX
Android - Frameworks de Persistência
Édipo Souza
 
PPTX
Framework MVC - vRaptor
Édipo Souza
 
PDF
XP - eXtreme Programming
Édipo Souza
 
Estudo comparativo das linguagens kotlin e java no desenvolvimento de aplicac...
Édipo Souza
 
Android, Gradle & Dependecies
Édipo Souza
 
Testing android apps with espresso
Édipo Souza
 
Next Step, Android Studio!
Édipo Souza
 
Introdução a Plataforma Android
Édipo Souza
 
Apresentação de minha Monografia do curso de Sistema e Mídias Digitais
Édipo Souza
 
UMA ANÁLISE COMPARATIVA DE FERRAMENTAS DE DESENVOLVIMENTO MULTIPLATAFORMA PAR...
Édipo Souza
 
Android - Frameworks de Testes
Édipo Souza
 
Android - Frameworks para Gráficos
Édipo Souza
 
Logging Patterns & Anti-Patterns
Édipo Souza
 
Android - Frameworks de Persistência
Édipo Souza
 
Framework MVC - vRaptor
Édipo Souza
 
XP - eXtreme Programming
Édipo Souza
 
Ad

Recently uploaded (20)

PPT
Wireless Communications Course lecture1.ppt
abdullahyaqot2015
 
PPTX
some leadership theories MBA management.pptx
rkseo19
 
PPTX
A brief History of counseling in Social Work.pptx
Josaya Injesi
 
PPTX
Presentationexpressions You are student leader and have just come from a stud...
BENSTARBEATZ
 
PPTX
Pastor Bob Stewart Acts 21 07 09 2025.pptx
FamilyWorshipCenterD
 
PPTX
STURGEON BAY WI AG PPT JULY 6 2025.pptx
FamilyWorshipCenterD
 
PPTX
AI presentation for everyone in every fields
dodinhkhai1
 
PDF
Leveraging the Power of Jira Dashboard.pdf
siddharthshukla742740
 
PPTX
2025-07-13 Abraham 07 (shared slides).pptx
Dale Wells
 
PPTX
Inspired by VeinSense: Supercharge Your Hackathon with Agentic AI
ShubhamSharma2528
 
PDF
FINAL ZAKROS - UNESCO SITE CANDICACY - PRESENTATION - September 2024
StavrosKefalas1
 
PPTX
g1-oral-comm-1.pptx dkekekwkwoowowwkkrkrrkfkfkfm
hnanie845
 
PPTX
Food_and_Drink_Bahasa_Inggris_Kelas_5.pptx
debbystevani36
 
PPTX
677697609-States-Research-Questions-Final.pptx
francistiin8
 
PDF
Generalization predition MOOCs - Conference presentation - eMOOCs 2025
pmmorenom01
 
PPTX
Bob Stewart Humble Obedience 07-13-2025.pptx
FamilyWorshipCenterD
 
PDF
Medical Technology Corporation: Supply Chain Strategy
daretruong
 
PPTX
presentation on legal and regulatory action
raoharsh4122001
 
PDF
CHALLENGIES FACING THEOLOGICAL EDUCATION IN NIGERIA: STRATEGIES FOR IMPROVEMENT
PREVAILERS THEOLOGICAL SCHOOL FCT ABUJA
 
PPTX
BARRIERS TO EFFECTIVE COMMUNICATION.pptx
shraddham25
 
Wireless Communications Course lecture1.ppt
abdullahyaqot2015
 
some leadership theories MBA management.pptx
rkseo19
 
A brief History of counseling in Social Work.pptx
Josaya Injesi
 
Presentationexpressions You are student leader and have just come from a stud...
BENSTARBEATZ
 
Pastor Bob Stewart Acts 21 07 09 2025.pptx
FamilyWorshipCenterD
 
STURGEON BAY WI AG PPT JULY 6 2025.pptx
FamilyWorshipCenterD
 
AI presentation for everyone in every fields
dodinhkhai1
 
Leveraging the Power of Jira Dashboard.pdf
siddharthshukla742740
 
2025-07-13 Abraham 07 (shared slides).pptx
Dale Wells
 
Inspired by VeinSense: Supercharge Your Hackathon with Agentic AI
ShubhamSharma2528
 
FINAL ZAKROS - UNESCO SITE CANDICACY - PRESENTATION - September 2024
StavrosKefalas1
 
g1-oral-comm-1.pptx dkekekwkwoowowwkkrkrrkfkfkfm
hnanie845
 
Food_and_Drink_Bahasa_Inggris_Kelas_5.pptx
debbystevani36
 
677697609-States-Research-Questions-Final.pptx
francistiin8
 
Generalization predition MOOCs - Conference presentation - eMOOCs 2025
pmmorenom01
 
Bob Stewart Humble Obedience 07-13-2025.pptx
FamilyWorshipCenterD
 
Medical Technology Corporation: Supply Chain Strategy
daretruong
 
presentation on legal and regulatory action
raoharsh4122001
 
CHALLENGIES FACING THEOLOGICAL EDUCATION IN NIGERIA: STRATEGIES FOR IMPROVEMENT
PREVAILERS THEOLOGICAL SCHOOL FCT ABUJA
 
BARRIERS TO EFFECTIVE COMMUNICATION.pptx
shraddham25
 

Android studio build variants

  • 2. About me Édipo Souza ● Work at GREat/UFC in SeDAn project. ● Édipo Souza has over 3 years experience in android development with degree in Sistemas e Mídias Digitais by Federal University of Ceará. ● He has certifications Oracle Certified Associate Java SE 8 Programmer and Microsoft Programming in HTML5 with JavaScript and CSS3 Specialist. http://www.ediposouza.com
  • 3. ● What’s Build Variant? ● Build Variant Advantages ● How to Use Create ● Build Variant and Build Type ● How to Use It ● References Schedule
  • 4. It’s a feature of build system that allows you to create different versions of same app in a single project. What’s Build Variant?
  • 5. ● Demo version (incomplete app) ● Free version (full app advertising) ● Pro version (full app without advertising) ● Trial version (full app for a limited time) ● Specific version for devices with physical buttons What’s Build Variant?
  • 6. ● Centralize and organize all code related to your application ● Avoid code duplication in separate projects ● Facilitate the implementation of maintenance ● Keep all versions always updated Build Variant Advantages
  • 7. ● For each new version of the app, declare a flavor within item productFlavors in app build.gradle with a name that define it. ● You can overwrite any existing items in DefaultConfig like applicationId in example bellow. productFlavors { demo { applicationId "com.ediposouza.app_name.demo" } full { } } How to Create
  • 8. ● Create a folder with same flavor name in src directory with java within it. ● You can also create Assets and res folders with files for this specific version. ● The variant can also have a Manifest with particular configuration that will be merged with main Manifest. How to Create
  • 9. ● Each build variant is a formed with combination of a flavor and a build type. ● All versions can be builded as debug or release type. ● You can still use BuildConfig.DEBUG boolean value to make adaptations between test version and production version. Ex: boolean serverUrl = BuildConfig.DEBUG ? testUrl : prodUrl; Build Variant and Build Type
  • 10. ● The classes and resources of active build variant will be merged with the main files. ● You can’t have a class in any variant with same name of one in main folder. However between two variant you often have classes with same name. The same is valid for resources. ● When create a new class or move an existing one, choose where it will be saved. How to Use It
  • 11. ● You can work only with a Build Variant at time and if have some flavor declared, at lest one have to be active. ● Does make sense to define just one flavor, because you main files will always be merged with same Variant files. ● To create test classes for a Build Variant, create a folder androidTest***flavor name***. ● The active variant can be changed in Build Variant tab and Each module have it own Build Variants.. How to Use It
  • 12. Demo
  • 13. Cool Links: ● http://ediposouza.com/android-studio-build-variant ● https://developer.android.com/tools/building/configuring-gradle.html#workBuildVariants Questions?