Hello guys,
Product Flavors is a great way to generate multiple apk with different configurations or flavors of your app. In this sample app we are create two flavor staging and production and separate base url and other variables.
Lets start
First you go to your module gradle and paste these lines
and now you create two dir by name "staging" and "prod" in src dir see below screenshot :
and now you create same package name under prod and statging like:-
And now you define base url or other variable which is use your project according to prod and staging.
finally done your flavor dimension. Now you run and choose your flavor
FullSource Code:ProductFlavors
Product Flavors is a great way to generate multiple apk with different configurations or flavors of your app. In this sample app we are create two flavor staging and production and separate base url and other variables.
Lets start
First you go to your module gradle and paste these lines
productFlavors { staging { dimension "version" applicationId "in.samset.androidflavorsample.statging" //Configure this flavor specific app name published in Play Store resValue "string", "flavored_app_name", "Staging App" } prod { dimension "version" applicationId "in.samset.androidflavorsample.prod" //Configure this flavor specific app name published in Play Store resValue "string", "flavored_app_name", "Prod App" }}
and now you create two dir by name "staging" and "prod" in src dir see below screenshot :
and now you create same package name under prod and statging like:-
finally done your flavor dimension. Now you run and choose your flavor
FullSource Code:ProductFlavors
No comments:
Post a Comment