A product flavor defines a customized version of the application build by the project. A single project can have different flavors which change the generated application
ex: set two different flavors of your app
productFlavors {
develop {
applicationId "com.your.app.1"
versionName "1.0.0"
buildConfigField 'String', 'HOST', '"http://api.zuul.com"'
buildConfigField 'String', 'FLAVOR', '"prod"'
buildConfigField "boolean", "REPORT_CRASHES", "true"
}
product {
applicationId "com.your.app.2"
versionName "1.0.1"
buildConfigField 'String', 'HOST', '"http://api.zuul.com"'
buildConfigField 'String', 'FLAVOR', '"prod"'
buildConfigField "boolean", "REPORT_CRASHES", "true"
}
so you can use the BuildConfig as:
CustomAdapter adapter = new CustomAdapter.Builder()
.setEndpoint(BuildConfig.HOST)
.build();
- Create package: src/develop/res/drawable/ic_launcher.png
- Also works with other types of resources like
strings.xml
,integers.xml
,arrays.xml