Search code examples
androidfirebasefirebase-crash-reporting

Difficulties setting up Gradle to send ProGuard mapping files to Firebase


I am trying to follow this documentation tutorial by Firebase to setup Android Studio to automatically send my ProGuard mappings file when building a release APK for my Android application.

However, I couldn't seem to understand steps 4 and 5 in the "Uploading ProGuard mapping files with Gradle" part, mainly because I didn't find any gradle.properties file in my project root or home path and because I wish to automate the execution of the app:firebaseUploadReleaseProguardMapping task in Android Studio, which I don't know how to do.

This is the contents of the gradle.properties file I've created in my project root directory:

FirebaseServiceAccountFilePath = /app/firebase-crash-reporting.json

The firebase-crash-reporting.json file is my Firebase crash reporting private key. My mappings file is generated in the /app/build/outputs/mapping/release/ directory, if that helps.

Please assist me in completing those 2 steps and automatizing the process in Android Studio.


Solution

  • gradle.properties is owned and managed completely by you. You have to create it if it doesn't already exist. This means you should probably read the Gradle documentation on it to best understand how it provides properties to your builds, and which location is best for your properties.

    You are not even obliged to use gradle.properties. You can also specify all the properties for the Crash Reporting plugin via the command line.

    When you specify a path for the service account file, you should specify the full, unambiguous path to the file. In your example, it looks like you're assuming that it will look under the app directory in your project. If you want to do that, you still have to give the full path to the file.