12

Am trying out the recently released feature that allows uploading of ProGuard mapping file to Firebase (https://firebase.google.com/docs/crash/android) using gradle task. The following is the task I'm running.

./gradlew -PFirebaseServiceAccountFilePath=xxxxx.json :app:firebaseUploadReleaseProguardMapping 

However, it doesn't seem to be recognizing service account file. Has anyone had any luck getting this working? I've also tried defining FirebaseServiceAccountFilePath in gradle.properties.

* What went wrong: Execution failed for task ':app:firebaseUploadReleaseProguardMapping'. > Service account file path has not been defined! Service accounts are used to authorize your mapping file uploads. Learn more at https://firebase.google.com/docs/crash/android. 

3 Answers 3

24

Set relative path to json in gradle.properties (in project root)

FirebaseServiceAccountFilePath = /firebase-crashreporting.json 

and update this property in your build.gradle

apply plugin: 'com.android.application' apply plugin: 'com.google.firebase.firebase-crash' android { ... } setProperty("FirebaseServiceAccountFilePath", rootProject.rootDir.absolutePath + FirebaseServiceAccountFilePath) dependencies { ... } 
Sign up to request clarification or add additional context in comments.

1 Comment

Should be the accepted answer since it's more elegant than specifying the explicit, non relative path
5

The error message is misleading. You will see that if the file path that you give for the service account wasn't found. Try passing the full, unambiguous path of the service account file (try not to depend on relative paths).

I'll make sure that the next version of the plugin has a more meaningful error message for the case where the file isn't found. Sorry about the trouble.

9 Comments

Thanks Doug. Using full path got me past that issue. The next error I'm getting is FileNotFoundException: <my_path>/google-services.json". I guess it makes sense that there'd be dependency on google-services.json (for various reasons we're using FirebaseApp.initializeApp() to init firebase rather than depending on existence of that file)
Got it. That's a completely different problem. I'll have to file a different issue to let you pass the project id through the command line as well. For now, you could try to download your project's google-services.json file and put it in the expected place just so the plugin can get a hold of what it needs in order to perform the upload.
The issue we have with doing that is that same code/build is used to build a (dynamic) number of different apps.
Ah, yeah, I was just writing that case into the bug report. but yeah, my proposed workaround won't be easy for you, as you'd have to copy a new file into place for each variant, and run them all individually.
For what it is worth, I used a relative path. Relative to the app module directory and not the project directory.
|
0

In my case I was using Jenkins to upload the proguard mappings for me. I had to change the file permissions for the json private key file from 400 to 444.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.