Search code examples
androidandroid-resourcesandroid-build-typeandroid-flavorsappboy

Android flavor and build variant specific appboy.xml file


Regarding an Android app having different flavors and build variants, I'm quite familiar with how to build certain string resources flavor & build variant specific. But for a file I'm not sure how that works.

More concretely, I'm integrating Appboy into my app only for a specific flavor, the api key is different for the different build variants. So how can I manage to do this?

My appboy.xml file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!--Appboy api key, used in debug and preview builds-->
    <string name="com_appboy_api_key">MY_APPBOY_API_KEY</string>
</resources>

Thanks!


Solution

  • you can create for each Flavor/build variant a directory and put your Appboy configuration in it:

    • Flavor1Debug : app/src/flavor1Debug/res/values/appboy.xml
    • Flavor1Release :app/src/flavor1Release/res/values/appboy.xml
    • Flavor2Debug :app/src/flavor2Debug/res/values/appboy.xml
    • Flavor2Release :app/src/flavor2Release/res/values/appboy.xml