Skip to content

Instantly share code, notes, and snippets.

@marcouberti
Last active February 16, 2017 16:41
Show Gist options
  • Save marcouberti/b2307f2298ed79ffb944ce562acd4131 to your computer and use it in GitHub Desktop.
Save marcouberti/b2307f2298ed79ffb944ce562acd4131 to your computer and use it in GitHub Desktop.
Copy and rename mapping.txt file if minify is enable
android {
applicationVariants.all { variant ->
def versionCode = android.defaultConfig.versionCode
def versionName = android.defaultConfig.versionName
def appendToFileName = versionName + "-build-" + versionCode
// copy and rename mapping.txt file if in minify is enable
if (variant.getBuildType().isMinifyEnabled()) {
variant.assemble.doLast{
copy {
from variant.mappingFile
into "${rootDir}/mappings"
rename { String fileName ->
"mapping-${variant.name}-${appendToFileName}.txt"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment