Gradle – Automatically rename the .apk file and copy the ProGuard mapping.txt file

ProGuard writes the mapping file under the build directory of the project. Under normal circumstances all files and directories under the build dirs are excluded from version control. That is a bit of an issue if you want to be able to save that file with every release build. I always forget to this manually. So, let’s do that at build time with Gradle and while we are at it, we might as well rename our apk file, so we don’t have to do that manually either.

Android Studio- What files and directories to exclude when importing into Subversion (or Git)

List of directories and files to be excluded when importing into a version control (relative to the root of the project): .gradle (directory) build (directory) (file) app/build (directory) .idea/libraries (directory) .idea/gradle.xml (file) .idea/workspace.xml (file) There are a couple of