viernes, 4 de mayo de 2018

Android: Creating different environments

app build.gradle

flavorDimensions "pack"
productFlavors {
    qa {
        applicationId "com.pridelandTechnologiesLLC.kayuQA"        
        resValue "string", "app_name", "Kayu QA"
        dimension "pack"
    }
    prod {
        applicationId "com.pridelandTechnologiesLLC.kayu"
        resValue "string", "app_name", "Kayu"
        dimension "pack"
    }
}


You can add many other attributes in the same fashion.


If you want to have an app for qa in firebase and one in prod create a folder qa
 and another folder prod in the same level as main. I.E.:


<your_app>

   app
      src
         main
         qa
            google-services.json // The one related to qa
         prod
            google-services.json // The one related to prod
To run the different environments you need to select them on the Build Variants.
 Located at the bottom left of the menu (above Favorites).