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" } } } } } } }
Frank
source share