How to provide different launcher icon per product flavour How to provide different launcher icon per product flavour android android

How to provide different launcher icon per product flavour


You have a couple options:

  1. Switch to the new android studio/gradle layout and create folders for your productFlavors:

    src/main/ - Shared code/resources across all flavors
    src/amazon - Amazon specific code/resources across all flavors
    src/google - Google specific code/resources accross all flavors

    So in your main manifest (src/main/AndroidManifest.xml) if your android:icon is @drawable/icon, you would have the appropriate icon located in src/amazon/res/drawable-*/icon.png and likewise for the rest of your productFlavors.

  2. Keep your existing layout (and build.gradle) and append a resource directory to the res.srcDirs:

So, for your amazon sourceset:

android.sourceSets.amazon {    res.srcDirs = ['res', '/path/to/amazon/res/dir']}

And then in your /path/to/amazon/res/dir/drawable-* you would have your launcher icon.