Skip to content

Instantly share code, notes, and snippets.

@Mistic92
Last active August 4, 2016 21:15
Show Gist options
  • Save Mistic92/bc3d6a39701d145f650de94cdcd9e282 to your computer and use it in GitHub Desktop.
Save Mistic92/bc3d6a39701d145f650de94cdcd9e282 to your computer and use it in GitHub Desktop.
Script to copy .apk and mapping file to /deploy/v+versionCode+versionName location. Helps to save apk with corresponding mapping file.
android {
applicationVariants.all { variant ->
def apk
def deployPath
variant.outputs.each { output ->
if (output.outputFile?.name?.contains('release')) {
apk = output.outputFile
}
}
if (variant.getBuildType().isMinifyEnabled()) {
variant.assemble.doLast {
copy {
from variant.mappingFile
from apk
deployPath = "${rootDir}/deploy/v" + variant.versionCode + '_' + variant.versionName
println deployPath
into deployPath
}
if (System.properties['os.name'].toLowerCase().contains('windows')) {
deployPath = deployPath.replaceAll("/", "\\\\")
Runtime.getRuntime().exec("explorer.exe " + deployPath);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment