I have an application that has to be branded for two different customers. The application design, code, usage and flow are identical. The branding is purely changing android resources to use different colors and fonts, currently. It's also possible that they would use different drawables and layouts. Also there are some resources that are the same for both brands.
Currently, we just have two different projects with duplicate code files but different sets of resource files.
Is it possible to have one project with all the resources (common resources, brand-1 resources and brand-2 resources) and have a compile time flag to decide which set of resources to use?
Edit: I am looking for something similar to having different sets of layouts and resources based on screen size and densities.
Use Android studio.
In android studio you will have flavor
folder inside project.
one can put resources according to the flavor.
example:
Project-
flavor-
demo-
| src-
| res-
| drawable-
| ic_launcher.png
brand1-
| src-
| res-
| drawable-
| ic_launcher.png
brand2-
src-
res-
drawable-
ic_launcher.png
and specify this in your gradle file like this.
android{
....
productFlavors {
demo {
applicationId "com.example.app.demo"
versionName "1.0.3"
}
brand1 {
applicationId "com.example.app.brand1"
versionName "1.0"
}
brand2 {
applicationId "com.example.app.brand2"
versionName "1.4"
}
}
...}
You have option to choose the Build Variant at the left side of android studio.It will pick up the resource according to the flavor you choose.
Please note: Android Studio is slow. You should have minimum of 8gb ram.