Firebase upload symbol files build error: Unexpected argument 'ServiceAccount.json'

Johnykutty picture Johnykutty · Aug 29, 2016 · Viewed 9.1k times · Source

I am trying to implement crash reporting with firebase. I followed the documentation here. And renamed the downloaded son file to ServiceAccount.json. Then copied it to project directory. Also changed the script. Now my build phase run script looks like

# Replace this with the GOOGLE_APP_ID from your GoogleService-Info.plist file
GOOGLE_APP_ID=1:.....#my app id

# Replace the /Path/To/ServiceAccount.json with the path to the key you just downloaded
"${PODS_ROOT}"/FirebaseCrash/upload-sym "ServiceAccount.json"

But when I try to build the project its giving build error

Unexpected argument 'ServiceAccount.json'
usage: /Users/<full path>/Pods/FirebaseCrash/upload-sym [-h] [-v] [-w|-e]
Command /bin/sh failed with exit code 2

Whats wrong with my steps?

Answer

Abdul Rehman picture Abdul Rehman · Aug 29, 2016

This is the script I use in my practice project.

JSON_FILE=${SRCROOT}/*****/ServiceAccount.json
GOOGLE_APP_ID=1:**********:ios:*********

defaults write com.google.SymbolUpload version -integer 1

JSON=$(cat "${JSON_FILE}")
/usr/bin/plutil -replace "app_${GOOGLE_APP_ID//:/_}" -json "${JSON}" "$HOME/Library/Preferences/com.google.SymbolUpload.plist"
"${PODS_ROOT}"/FirebaseCrash/upload-sym

If your JSON file is in the project folder "XYZ" then you only need this "JSON_FILE=${SRCROOT}/XYZ/ServiceAccount.json" or if it is in a subFolder of XYZ then like this "JSON_FILE=${SRCROOT}/XYZ/subFolder/ServiceAccount.json"

And set you GOOGLE_APP_ID and that is it. sorry for bad English. Hope It helps :)