Is there a way to auto-copy the Proguard mapping files to the (selected) target APK directory in Android Studio, every time a live build finishes?
Asked
Active
Viewed 1,053 times
9
-
How about adding `-printmapping build/outputs/yourpath../mapping.txt` to the rules file? – Vrashabh Irde Oct 20 '15 at 12:36
-
1Also : http://stackoverflow.com/a/28948693/1081340 if that helps you – Vrashabh Irde Oct 20 '15 at 12:37
1 Answers
9
This solution will copy the generated mapping.txt to {targetDir}/mapping/ where {targetDir} is the target APK dir. (This solution will also add a date in the txt filename.)
Edit the build.gradle of your app module, update the android task:
android {
... // your usual stuff
applicationVariants.all { variant ->
variant.outputs.each { output ->
if (variant.getBuildType().isMinifyEnabled()) {
variant.assemble.doLast{
copy {
from variant.mappingFile
into output.outputFile.parent + "/mapping"
rename { String fileName ->
"mapping-${variant.name}-${new Date().format('yyyy_MM_dd')}.txt"
}
}
}
}
}
}
}

Frank
- 12,010
- 8
- 61
- 78