How to add custom Proguard files to build.gradle?

I use Crashlytics in my game. When I build it, I export it as a Gradle project. I’d like the generated build.gradle to include a custom Proguard configuration file for Crashlytics. From this question I know that you can add your own custom build.gradle template. The default template contains the following line:

proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-unity.txt’**USER_PROGUARD**

How can I set **USER_PROGUARD** and where should I put my Proguard configuration file for this to work?

Just figured out how to do this in order to resolve a gradle build error I was having. I posted an answer on StackOverflow.