I am working on an android project.I want to build this project by gradle.
And I need to generate 20 apk files according to the different market
channels.The difference of the files is that in the manifest file ,I need
to replace the string"UMENG
*VALUE"with each channel name. My current way is to use product flavor like
this: *
*productFlavors {
develop{}
official{}
ika{}
}
android.applicationVariants.all{variant ->
variant.processManifest.doLast{
def manifestFile =
"${buildDir}/intermediates/manifests/${variant.dirName}/AndroidManifest.xml"
new File(manifestFile).write(new
File(manifestFile).getText('UTF-8').replaceAll("@string/channel*id",
"${variant.productFlavors[0].name}"), 'UTF-8')
variant.processResources.manifestFile =
file("${buildDir}/intermediates/manifests/${variant.dirName}/AndroidManifest.xml")
}
}
But the problem of this method is that gradle will execute every task
according to each flavor right? But in my opinion , most of the steps are
exactly the same. So is there a better way for gradle to just compile and
dex for only one time and just change the String in manifest file?
--
You received this message because you are subscribed to the Google Groups
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.