Using Flavors

To set up your Android Product Flavors
  1. Open the app level gradle file (:app). 

  2. Add the following entries into the build.gradle file, please edit the code block as requirements of your project:

    android{
      ...
      // edit and add code as below
      productFlavors{
    
        flavorDimensions 'default' //the essential line
    
    
        //for single demo, only the dimension in required 
    
        exampleDemo{
    
          dimension 'default'
        }
    
        ​//for alpha or beta test flavor, please add applicationIdSuffix and versionNameSuffix
        projectRn{
    
          dimension 'default'
    
          applicationIdSuffix '.projectrn'
    
          versionNameSuffix '-Beta'
    
        }
    
        //for production flavor, please add applicationIdSuffix
    
        projectPd{
    
          dimension 'default'
    
          applicationIdSuffix '.projectpd'
        }
    
    
    
      }
    
      ...
    }
    ...
    //if the project requires AppCenter support, please edit and add code as below. Please note the name fields below shall follow the product flavor settings
    afterEvaluate{ project->
      assembleExampleDemoRelease.dependsOn tasks.getByName('decodeExampleDemoRelease')
      assembleProjectRnRelease.dependsOn tasks.getByName('decodeProjectRnRelease')
      assembleProjectPdRelease.dependsOn tasks.getByName('decodeProjectPdRelease')
    
    }
    ...
    
  3. ​For the configuration of product flavors with ObjectBox plugin, please refer to Entity Generation (Android).