Search code examples
xcodeeclipsetarget

set different build target in eclipse like in Xcode


I know the title might be a little misleading so if you find better words for what I mean, please feel free to modify it. I take the concept of 'target' from Xcode.

I'm an iPhone developer now turning to android one. With Xcode I can do the following, supposing I have a list of apps in which users grow different plants:

  1. I can set different target, e.g. apple, bear etc.

  2. for each target I can choose to load different database/UI images, they are all in the project file with same names but in different folders, and I can set which target uses which files.

  3. at building phase I simply choose targets and click build, and then I can have a list of my apps.

The advantage of this is I don't need to change anything in code, just grab the resources from designer and change a little project setting, and all is done.

Now with eclipse I can't find out how I can do that so simple. I have to remove old resources and copy new ones there to build for a different target. This takes too much time when I have to make an update for 20 apps. So is there a better to achieve what I'm requiring? any plugin for eclipse or there are some easy ways that I don't know yet?


Solution

  • I got a solution with Android Studio's Gradle Build System i-e defining different flavors of my app and then using build variant configuations, producing different apps from same/shared code base, resources etc.

    As per Android Developers Docs

    The build system uses product flavors to create different product versions of your app. Each product version of your app can have different features or device requirements. The build system also uses build types to apply different build and packaging settings to each product version. Each product flavor and build type combination forms a build variant. The build system generates a different APK for each build variant of your app. Now one can have two or more product flavors e.g (paid flavor, free/demo flavor) etc for one single project with same code base.

    For more information See Build Variants & Product Flavors Doc