Defining build types and flavors

We are approaching an important phase of our project--defining build variants for our application. Build variant stands for a unique version of an Android application.

They are unique because they override some of the application attributes or resources.

Each build variant is configured per module level.

Let's extend our build.gradle! Put the following code in the android section of the build.gradle file:

    android { 
      buildTypes { 
        debug { 
          applicationIdSuffix ".dev" 
        staging { 
          debuggable true 
          applicationIdSuffix ".sta" 
        preproduction { 
          applicationIdSuffix ".pre" 
           release {} 

We defined the following buildTypes for our application--debug, release, staging, and preproduction.

Product flavors are ...

Get Mastering Android Development with Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.