Take the 2-minute tour ×

We hope to build multiple applications based on the same source code. The base source code will be stored in SVN so at daily development we just need to modify one codebase.

While for different customers, we hope to given some some level of branding. Mostly changing images and titles, these can be done by just change the resources.

After some research, We find that it is really touch to do these multiple version applications. The main problem is that R.java is generated based on the package name. And package name identify the application. In the source code there are many files import this package.name.R, which means for different application, there will be different package name, and different R's reference need to be change in most source code file.

We find some articles on web about using Ant to do this task, but none of them are really specified. We hope someone could help!

Generally the workflow will be like this:

  1. Changing the package name in AndroidManifest.xml
  2. Go over all source code file, find and replace anything referenced to R to the new package name.
  3. Switch the res folder to the new client's res folder (We will have this folder ready)
  4. Auto generate R.java file.
  5. Start normal compile and build process.
  6. Get Apk.

We hope someone could point out how can we achieve these task by using Ant, or any other better solution.

Thank you!

share|improve this question
add comment

1 Answer

I think you should create an Android Library Project (http://developer.android.com/tools/projects/index.html#LibraryProjects) with the common code, check it into VCS, and then create separate projects for every customer which you should also check into VCS to keep track of them. You will be able to generate different customized versions from same source code.

share|improve this answer
Thank you for the replay. However I tried this but it seems not work for the case. The main reason is that we have around 15 customer and it will be really hard to keep the long list. Also it seems the structure of our project is not really do composed into library. –  Arthur0902 Feb 5 '13 at 21:35
I don't see anything wrong in creating 16 projects you can track vs. changing things at build time that would not be able to reproduce to generate a previous APK. The library project would be the same you have now. –  dtmilano Feb 5 '13 at 22:12
add comment

Your Answer


