How to provide different launcher icon per product flavour

前提是你 提交于 2019-11-28 22:51:43

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!