Search code examples
androideclipseandroid-build

Android Build - Select app name and icon at compile time


I have developed a Stock Control app in Android that will be used for many people. Each of them will have the same app in the core but with different icon and different name.

So I have decided to have only one project in Eclipse (Stock Control) and when X person needs the app I will build the APK based on that Eclipse Project but at the same time deciding specific icon and specific app name.

So only thing that will change between compiled APKs will be the app name (strings.xml?) and icon (drawable-?dpi/ic_launcher).

I need a command line for console or something like:

makeapk projectName

Scenario:

We have

  • The Android (Eclipse) Project: stock

  • Folders stockNorth and stockSouth, each with two folders inside: values and drawable

So when I run the magic command makeapk stockNorth it compiles everything from stock project except values and drawable folders, because it picks them up from stockNorth folder.

Then I get the APK with custom icon and strings .

Is this possible?

EDIT: Should I follow something like this? Eclipse building Android app: How can I create two versions/editions at compile-time?

EDIT 2: The idea is only have one project and NOT to create one each time I need a new APK. One project and compile it with some parameters that change the icon and the strings of the current building APK.


Solution

  • Yeah, from that link, you could set up a Library Project that has all core features, then create a new project for each version of the app that then overrides the files that need to be changed.

    I don't know about ANT or setting up a build process for that.

    However, you should migrate to Android Studio, the newer IDE for Android Development. which provides "Build Flavors" that let you build different versions of your app from one project (and you can still go the library project route if you so choose).