Search code examples
androidgradlehockeyapp

Android HockeyApp SDK v 3.7.1 use different app ID for different targets


I integrated the HockeySDK for Android following this tutorial: https://github.com/bitstadium/HockeySDK-Android#setup. In the default config of gradle set App ID set described in tutorial manifestPlaceholders = [HOCKEYAPP_APP_ID: "appID"] For a single app it works fine but my project contains different product flavors and I need to use different App IDs for each flavor. Is it possible to use App ID from strings resources for appropriate target instead "appID" in gradle?


Solution

  • You answered your question pretty much all by yourself, you define your different flavors and define different manifest placholders. The following snippet defines two flavors for internal and release builds with different values for the HockeyApp appId and appSecret.

    productFlavors {
            internal {
                applicationId "YOUR_VALUE_HERE"
                manifestPlaceholders = [HOCKEYAPP_APP_ID: "YOUR_VALUE_HERE", HOCKEYAPP_APP_SECRET: "YOUR_VALUE_HERE]
                versionCode 1
                //maybe some more stuff for your flavor
            }
            live {
                applicationId "YOUR_VALUE_HERE"
                manifestPlaceholders = [HOCKEYAPP_APP_ID: "YOUR_VALUE_HERE", HOCKEYAPP_APP_SECRET: "YOUR_VALUE_HERE]
                versionCode 1
                //maybe some more stuff for your flavor
            }
        }