Generate custom package names for Android apps with Gradle -
let's have fours apps package name com.demo_uat, com.demo_prod, com.demo1_prod , com.demo1_uat. this, i'm using gradle , buildtypes/productflavors mechanism.
i tried doing following :
buildtypes { uat.initwith(buildtypes.debug) uat { applicationidsuffix "_uat" } prod.initwith(buildtypes.release) prod { applicationidsuffix "_prod" } } productflavors { demo { applicationid "com.demo" } demo1 { applicationid "com.demo1" } }
but default, gradle adds "." @ beginning of _uat , _prod , produce output : com_demo._uat, com_demo._prod, com_demo1._uat , com.demo1._prod.
is possible override behavior ? keep underscore.
i found workaround. here did :
android { ... buildtypes { prod.initwith(buildtypes.release) prod { } uat.initwith(buildtypes.debug) uat { } } productflavors { demo { applicationid "com.demo" } demo1 { applicationid "com.demo1" } } } task editapplicationid { android.applicationvariants.all { variant -> variant.mergedflavor.applicationid = variant.mergedflavor.applicationid + "_" + variant.buildtype.name } } assemble.dependson(editapplicationid)
Comments
Post a Comment