android tutorial - Defining product flavors in Android | Developer android - android app development - android studio - android app developement



Defining product flavors

  • Product flavors are defined in the build.gradle file inside the android { ... } block as seen below.
...
android {
    ...
    productFlavors {
        free {
            applicationId "com.example.app.free"
            versionName "1.0-free"
        }
        paid {
            applicationId "com.example.app.paid"
            versionName "1.0-paid"
        }
    }
}
click below button to copy code from our android learning website - android tutorial - team
  • By doing this, we now have two additional product flavors: free and paid. Each can have its own specific configuration and attributes. For example, both of our new flavors has a separate applicationId and versionName than our existing main flavor (available by default, so not shown here).

Related Searches to Defining product flavors in Android