Android copy of Proguard for Android Android Studio

Is there a way to autocopy Proguard mapping files to the (selected) destination APK directory in Android Studio, every time a live build ends?

+7
android android-studio proguard
source share
1 answer

This solution will copy the generated mapping.txt file to {targetDir} / mapping / where {targetDir} - the destination APK directory. (This solution will also add a date in the txt file name.)

Edit the build.gradle of your application 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" } } } } } } } 
+5
source share

All Articles