I am facing an issue where I am not able to generate the desired resource files. In my project setup I have defined certain values in resource files(keys.xml) that are different between flavors(amazon, googlePlay). The problem mainly occurs because the keys are also different between the live/qa builds.
So the final keys I would like to have are:
- amazonPaidQa -> keys from 'src/amazon/res/values/keys.xml'
- amazonPaidLive -> keys from 'src/amazonPaid/res/values/keys.xml' (not working as this requires me to define the keys file in 'src/amazonPaidLive')
My question is if it is possible to define resources in 'interim' build variants like the above mentioned 'amazonPaid' so that I would not have to duplicate that file between all possible live build variants(amazonPaidLive, amazonFreeLive). Or maybe someone has a better suggestion how to approach this problem?
build.gradle definitions
buildTypes {
qa {
//config
}
live {
//config
}
}
flavorGroups "market", "client"
productFlavors {
//define the market flavors
amazon {
flavorGroup "market"
}
googlePlay {
flavorGroup "market"
}
//define the client flavors
free {
flavorGroup "client"
packageName "com.example.free"
}
paid {
flavorGroup "client"
packageName "com.example.paid"
}
}
The folder structure is the following:
- src/main
-- AndroidManifest.xml
-- res/values/keys.xml
- src/live
- src/qa
- src/amazon
-- res/values/keys.xml
- src/googlePlay
-- res/values/keys.xml
- src/paid
- src/free
Android Manifest snippet
<application>
...
<meta-data android:name="app_id" value="@string/app_id" />
</application>