I've a multi flavor project which is built by a CI and published to HockeyApp. Each flavor has an applicationId and an apiToken, which is stored in the flavor itself (to keep all important variables in one place):
def token = null
productFlavors {
prod {
applicationId "de.example.appname"
buildConfigField 'String', 'FLAVOR_ID', '"0"'
buildConfigField 'String', 'HOCKEY_APP_ID', '"1234567890"'
token = "1q2w3e4r5t6z7u8i9o0p"
}
demo {
applicationId "de.example.appname.demo"
buildConfigField 'String', 'FLAVOR_ID', '"1"'
buildConfigField 'String', 'HOCKEY_APP_ID', '"987654321"'
token = "p0o9i8u7z6t5r4e3w2q1"
}
}
On the same level like "productFlavors" there are the hockeyApp-settings:
hockeyapp {
apiToken = token
releaseType = 0
notify = 0
status = 1
notesType = 1
notes = "Uploaded with gradle"
}
For debugging the code I build & upload the .apk-file via terminal:
./gradlew uploadProdReleaseToHockeyApp [...]
Unfortunately the variable token of the prod-flavor is always overridden by the demo-value. So after each uploading process I get errors like
Error response from HockeyApp: App could not be created.
because gradle tries to upload the prod-flavor with the demo-token.
Here some additional basic data:
compileSdkVersion 24
buildToolsVersion "24.0.1"
compile 'net.hockeyapp.android:HockeySDK:4.0.0'
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'de.felixschulze.gradle:gradle-hockeyapp-plugin:3.5'
Based on my requirements, is there a solution to define flavor-variables and access them in the shown way?