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)

Update Oct. 17, 2019: ——————— This is the official .gitignore file maintained by JetBrains: https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore ——————— List of directories and files to be excluded when importing into a version control (relative to the root of the project): .gradle (directory) build