Best practice for flavored gradle build options in android studio

I have an application that is produced for different brands. Now I have two flavors, brand1 and brand2. The difference between brand1 and brand2 are just resource files.

At first, I suggested that I could install all the general data in my main path and the differences in the flavored path. But in this case, my build failed because there are no resources in my main path.

I would continue like this: to establish all the differences in resources between brands in the main way as dummy data. Merging will do the rest for me.

In iOS, I can set the build path for each build target. Is something like this possible with aromas? Or what is the best practice in this situation?

[EDIT 2013 08 07]

In my case, the problem was that I created the application in eclipse and exported it to android studio. Here, the problem and solution are described more accurately.

+4
source share
1 answer

Another solution is to host the entire common (mostly "vanilla" version of your application) as a libary project, including default resources.

Then you can create separate β€œbrand” projects that use the library project. Any resources that you invest in them will overwrite the resources of the library project.

http://developer.android.com/tools/projects/projects-eclipse.html#SettingUpLibraryProject

I did this for clients, and it worked quite well.

+2
source

Source: https://habr.com/ru/post/1488304/


All Articles