Kristin Marsicano

Build Variants: Product Flavors

Kristin Marsicano | Nov 16, 2018

In this series, you will learn how to produce separate APKs from the same code base using product flavors. Each flavor will be branded differently, including a custom launcher icon, color scheme, and app name.

In this screencast, which is part 1 of the series, you will learn how to:

- Define product flavors in your gradle file, each with a custom application id
- Build and install flavored variants

In the next video you will learn how to use the main source set to share java and resource files, and also how to create custom source sets for each flavor to provide custom resource files for each flavored variant.

You can use these same techniques in any scenario where you want to build apps with similar functionality and tweak them slightly, such as having a free and paid version of your application.

For the More Curious...

Android Build Variants
BNR Guide to Android
Android & Kotlin Courses

Subscribers Only

Transcripts are for subscribers. Create an account today to access our collection of screencasts, skill packs, and more.

Subscribers Only

Project files are only available for subscribers. Create an account today to access our collection of screencasts, skill packs, and more.

Need Help?

If you get stuck, try starting a discussion with Big Nerd Ranch experts in the community tab.

Related Screencasts

Explore other screencasts related to this topic.

Build Variants: Source Sets

6 minutes

In this series, you will learn how to produce separate APKs from the same code base using product flavors. Each flavor will be branded differently, including a custom launcher icon, color scheme, and app name. In this screencast, part 2 of the series, you will learn how to share files across a main source set while providing custom versions of other files for the different app flavors.

Using Java 8 Lambdas to Clean Up Click Listener Code

8 minutes

Android view click listeners are often implemented inline using anonymous inner classes. Lambda syntax offers a more streamlined syntax. This video walks you through how lambda syntax map to anonymous inner class syntax, how to set up your project to support lambda syntax, and how to use Android Studio to make writing or converting to lambdas easy.

Kotlin Class Extensions

8 minutes

Class extensions are a powerful feature of Kotlin that allow you to add behavior to classes without extending them. In this video we will take a look at how to work with class extensions, some of the subtleties of how class extensions work with custom objects, and how to define your own class extensions to simplify your code.

SAM Type Conversion in Kotlin

7 minutes

In this screencast, we will do a recap on SAM Types, see how they work in Kotlin to support Java interoperability, and we'll also see some of the "gotchas" involved with the feature.

Converting a Java Android Project to Kotlin

8 minutes

Google announced official support for the Kotlin Programming language at google io 2017. In this video we will learn how to migrate our existing Java Android projects to the Kotlin language by using the automated Kotlin Conversion tools. In the process, we will also learn Kotlin language fundamentals, including the null safety features of the language, safe call operator, and how statics are represented in Kotlin.

Room Architecture

6 minutes

While Android SDK provides the APIs for using SQLite databases, they force developers to write a lot of boilerplate code. Room solves this problem by creating the glue code that saves objects to SQLite and reads them into memory. In addition, it performs some compile-time checks to ensure correctness of SQL queries.