FirebaseCrashlytics auto upload-symbols problem - ios

I'm trying to implement new FirebaseCrashlytics in my iOS app and having some issues and some things are not clear at all.
As per Upgrade doc in step 3, I have to add following run script:
${PODS_ROOT}/FirebaseCrashlytics/run
/path/to/pods/directory/FirebaseCrashlytics/upload-symbols
so, in my case it is:
"${PODS_ROOT}/FirebaseCrashlytics/run"
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols"
But compile was failing because:
Running upload-symbols in Build Phase mode
Validating build environment for Crashlytics...
Validation succeeded. Exiting because upload-symbols was run in validation mode
[31merror: No Google App ID or Google Services file provided[0m
Command PhaseScriptExecution failed with a nonzero exit code
If I delete upload-symbols line it is working fine, I'm getting crashes in Dashboard, but as far as I understand this upload-symbols has to upload dSYM files of app users, so I have no worry about this. Means I still need it...
So I tried to replace them:
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols"
"${PODS_ROOT}/FirebaseCrashlytics/run"
And it started to compile.
I did a force crash and got it in Dashboard, but also I got:
Does it mean that it is not working and it is must be after run, so I continued and finished with:
"${PODS_ROOT}/FirebaseCrashlytics/run"
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}"
Now I was able to compile, but still getting optional dSYM in Dashboard.
Now I'm completely lost, if anyone can clarify it would be great.
PS: I'm able to use upload-symbols from terminal, but it is kind of manual job.
Few more questions as a discussion:
Why in Upgrade docs it is run and upload script, but in Get started only run?
In Upgrade docs it is exact path for ${PODS_ROOT}/FirebaseCrashlytics/run but not exact for /path/to/pods/directory/FirebaseCrashlytics/upload-symbols they are same folder, why not use same?
in Get started docs there are input files and one of them is $(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH) why they are using (, not {?
This path $(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH) is path to Info.plist file, not to GoogleService-Info.plist why they gave it then?)

Related

Could not complete submission of dSYM, File no longer exists at (null)

I have migrated Fabric to Firebase/Crashlytics and I am getting this below build error for my run script in an iOS project,
Build Phase - Run Script
# Name of the resource we're selectively copying
GOOGLESERVICE_INFO_LOCATION=${PROJECT_DIR}/${TARGET_NAME}/App/Scripts/GoogleService-Info.plist
# Upload sysmbol
echo "Uploading dsym file"
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp ${GOOGLESERVICE_INFO_LOCATION} -p ios ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}
Build Error
[31merror: Could not complete submission of dSYM at /Users/me/Library/Developer/Xcode/DerivedData/Project-cmkidnrcwbunsqezgsrutqkmnivn/Build/Intermediates.noindex/ArchiveIntermediates/Project/BuildProductsPath/ReleaseOfficial-iphoneos/Project.app.dSYM: Error Domain=com.crashlytics.mac.error-domain.process-dsym Code=2 "File no longer exists at (null)" UserInfo={NSLocalizedFailureReason=File no longer exists at (null)}
Suggested in solution didn't work for me.
How to resolve it?
I recently got a new Mac and faced the same issue.
After trying lot of different things with no success, I found what was wrong. All I had to do, is to move my upload DSYM script at the bottom of the build phases script list.
We talk about this script:
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/YourPathToYourGoogleServiceFile/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
It has to be the last one executed
If this does not work, try this :
Comment your DSYM script, then archive your app.
Your archive should complete with success
Uncomment your DSYM script, and place it to the bottom list. (see correct order below)
Build a new archive.
Correct order :
run firebaseCrashlytics script.
run [CP] Embed pods frameworks
run DSYM Script
NB: In some cases, having a path containing some white spaces such as 'Supporting files' may lead to unexpected behaviour.

Xcode build never finishes when using Firebase upload-symbols in Build Phase Run Script

I have Firebase Analytics and Crashlytics enabled in my app. As per the Firebase website, I have implemented the following in my Run Script, under Build Phases in Xcode:
find dSYM_directory -name "*.dSYM" | xargs -I \{\} $PODS_ROOT/FirebaseCrashlytics/upload-symbols -gsp /path/to/GoogleService-Info.plist -p platform \{\}
I receive the following output from Xcode:
Running upload-symbols in Build Phase mode
Validating build environment for Crashlytics...
Validation succeeded. Exiting because upload-symbols was run in validation mode
The script allegedly completes its work successfully, as reported in Console.app. See attached screen capture for output.
The build progress does not progress any further after receiving the message above in Xcode. It is stuck at Building 2069 of 2081 tasks. I can successfully run this script manually, after a new app version has been distributed. But the whole point of Google providing this script for Firebase is to automate the whole process.
Has anyone had success in implementing the upload-symbols script in their Run Script? Any ideas why my Build stalls and never finishes?
I have found one other option that's working reliably. Modify your Run Script to the following: ${PODS_ROOT}/FirebaseCrashlytics/upload-symbols -bp That's it, just a single line. We discovered this by running upload-symbols --help from a terminal. Which said the following about the -bp, --build-phase command line argument. "Build Phase Mode is meant to run as an Xcode Run Script Build Phase. It finds the dSYMs and platform from the build environment variables, instead of having the caller pass them in. With this flag, <path> and --platform can be omitted."
You can also add the -d flag which logs a large but what appears to be very relevant information. Which is often hard to find in this process.
I realised I needed to add an input file for the run script. See below for implementation.

iOS and FirebaseCrashlytics

I am trying to follow the instructions on Firebase Docs to upload missing required dSYMs. However I am stuck on running the uploader script.
In my build phases I have
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols -gsp${SRCROOT}/GoogleService-Info.plist -p ios ${SRCROOT}/appDsyms"
When I try building the iOS app with this, I get the error:
line 4: /path/to/Pods/FirebaseCrashlytics/upload-symbols -gsp/path/to/GoogleService-Info.plist -p ios /path/to/appDsyms: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
When I try running the script from the terminal I get the error:
No Google App ID or Google Services file provided
I have verified that I have a Google Services file and am able to run my project using other firebase services that rely on it. I used to be able to upload Dysm files directly into the Firebase Console, but that changes on March 1.
Should this command be run as an XCode script or a command from the terminal? And, more importantly, does anyone understand how to resolve this issue?
As of May 2020:
After Fabrics shut down, many developers faced such issues because Fabric was automatically creating the script to upload dSYM files from Xcode and we never pay attention to it.
Now as Fabric is replaced with FirebaseCrashlytics, in order to achieve this automatic mechanism, you can create a new run script and paste this script there:
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
This script will get the dSYM files and upload them to firebase servers so that you can see the crashes.
For multiple Schemes:
If your project has multiple schemes, you can simply create multiple such scripts by changing the path to the Google Plist file.
NOTE: You can also manually upload the dSYM files using upload-symbols tool [Check here], but it's always better to automate the process wherever we can.
EDIT: July 2020:
When you see missing dSYM files for the crash in the Crashlytics dashboard, instead of getting the email for it, you can upload the dSYM file for the build as soon as you submit it for Apple review or for testing via Test Flight.
Missing dSYM is shown because when bitCode is enabled, the App Store Connect process the binary post uploading it and generates a new dSYM file.
You can find the dSYM file from the Activity section in the App Store Connect.
2020 FirebaseCrashlytics solution
You have two solutions :
1) From the command line
Go to your project folder and run :
./Pods/FirebaseCrashlytics/upload-symbols -gsp GoogleService-Info.plist -p ios <path_to_your_dsyms_zip>
You can get your dsym in Xcode organizer > right click on the archive > show in Finder -> Show content -> go to dsymm folder and compress it
2) From Xcode Build Phases
As described here (Firebase doc), you can add a Run Script phase in Xcode with this content :
"${PODS_ROOT}/FirebaseCrashlytics/run"
You also have to add these two input files under the run script :
${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}
and
$(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)
After hours of struggling with this problem finally solved it using this approach:
use this command in Terminal: /path/to/pods/directory/FirebaseCrashlytics/upload-symbols -gsp /path/to/GoogleService-Info.plist -p ios /path/to/dSYMs
Important thing is instead of /path/to/pods/directory you should enter the path to your pods folder in your application folder, and instead of /path/to you should enter the path to the GoogleService-Info.plist which is in your project folder too. And the last one is, instead of /path/to/dSYMs you should enter the path to your archive which has the format of .xcarchive.
For finding the .xcarchive path, you should first archive your application, then go to XCode -> Organizer and select your build, then right click on it and select "Show in finder" and then right click on your .xcarchive file and select "Show package contents". This is it, you can copy this path and paste it instead of /path/to/dSYMs and then hit enter to start uploading to Firebase Crashlytics.
Check out this link for more information:
Firebase Docs
While implementing FirebaseCrashlytics(Currently is in beta) for Crashlytics
Add new run script from Build Phases and add the following :
"${PODS_ROOT}/FirebaseCrashlytics/run"
In Input Files sections add
${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}
and
$(SRCROOT)/path to/GoogleService-Info.plist
If you still get dSYM missing error then try to run from terminal
/path/to/pods/FirebaseCrashlytics/upload-symbols -gsp /path/to/GoogleService-Info.plist -p ios /path/to/dSYMs
For path to FirebaseCrashlytics and GoogleService-Info.plist drag and drop from the actual location
For dSYMs path will be ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}
To get that hit the command with your project .xcodeproj and target xcodebuild -project YourProject.xcodeproj -target YourTarget -showBuildSettings
and replace your specific path
Please take note of the following while implementing Crashlytics
1. Run application in release mode
2. While testing disconnect device from mac
3. Set correct GoogleService-Info.plist
4. If you rename it, make sure you set the correct file name whenever required.
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp
"${PROJECT_DIR}/additional_folder/GoogleService-Info.plist" -p ios
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
I replaced my GoogleService-Info.plist in additional folder and made directory changes in shell script. Probably you should do the same
For terminal command you better drag and drop necessary file in terminal then copy selected path
/path_to_pods/FirebaseCrashlytics/upload-symbols -gsp
/path_to_google_service/GoogleService-Info.plist -p iOS /path_to_dSYMs
Believe me, I spent one day but nothing worked,
Surprisingly few solutions are working for a few projects for my colleagues but I'm using Big Sur & Xcode 12.2 nothing worked for me.
Tried 1: Each step mentioned in firebase doc.
Tried 2: Tried to upload symbol from terminal by passing path_to_pod_firebasecrshlytics/uploadsybol -gsp path_to/GoogleService-Info.plist -p ios path_to/dSYMs
But, No luck,
Following trick works for me,
Step 1: make sure you are on the latest firebase crashlytics version for it, give a path to project & fire cmd pod update
I was using Firebase Crashlytics version 4.0.0-beta.1 but after pod update it is 8.2.0
Step 2: Go to build phase add a run script bellow compile bundle resources "${PODS_ROOT}/FirebaseCrashlytics/run"
Step 3: Add DYSM Script, "${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/your_path/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
Step 4: Build project;
Step 5: Run project & Stop or disconnect from storyboard
Step 6: Make crash 2-3 times & wait for 2-5 mins.
Cheers, All Set!
We can do:
PATH_TO_GOOGLE_PLISTS="${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist"
To get a reference to the plist
Then use it:
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PATH_TO_GOOGLE_PLISTS}" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
Your Google Services path seems to be off. Here is an example of what my build phase looks like, which is able to successfully upload dSYM's. I suggest following these instructions one more time https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports-new-sdk?platform=ios&authuser=0.
find /Users/okodysh/Library/Developer/Xcode/DerivedData/myApp-ftqksfkpdvisbtaozpqzzjiizpfk/Build/Products/Debug-iphonesimulator -name "myApp.app.dSYM" | xargs -I {} $PODS_ROOT/FirebaseCrashlytics/upload-symbols -gsp /Users/okodysh/Desktop/iOSApps/myApp/myApp/GoogleService-Info.plist -p ios {}
Finally, I've figured it out and wrote a shell script to handle all this for me
Feel free to to use it: https://github.com/cs4alhaider/firebase-upload-symbols
Hmm nothing worked for me but changing this:
"${PODS_ROOT}/FirebaseCrashlytics/run"
to this:
"${PODS_ROOT}/FirebaseCrashlytics/run" -gsp "${PROJECT_DIR}/project_main_dir/google-services-files/iOS-GoogleService-Info.plist"
EDIT:
for those of you trying to complie to iOS's Catalyst:
you don't have to download two different Google JSON files. You should use only one (cause you have only 1 target). IF you want to upload a mac version of your app, just go to App Store Connect and create a new release for OSX (in the same page of your app)
In my case none were working until I added this:
"${PODS_ROOT}/FirebaseCrashlytics/run" -gsp "${PROJECT_DIR}/intermediate_folders/GoogleService-Info.plist"
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/intermediate_folders/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
If I didn't add the path to the run command, the build phase would be running forever...
Check you FULL project folder path whether it contains space. I solve it by moving my project into another folder path that doesn't have space.

Exiting because upload-symbols was run in validation mode

Im trying to add Fabric to my xcode project. I've done so succesfully in the past but now facing issues with a react-native project. Having looked around, i've tried pretty much all combinations suggested out there. My setup looks like so:
I've also tried the Pods version using "${PODS_ROOT}/Fabric/run" however no matter what i do im unable to proceed from the Add Run Script step.
In attempt to try and debug i've directed the output of what the Fabric command produces to a file. It yields the following:
Running upload-symbols in Build Phase mode Validating build
environment for Crashlytics... Validation succeeded. Exiting because
upload-symbols was run in validation mode
Any help much appreciated. Im very unsure as to how to take it from here
ADDITIONAL_INFO:
I've reinstalled the Fabric Mac app from scratch, restarted both xcode,fabric app and the whole system in general. Tried building in release mode and have pretty much tried everything here:
Crashlytics in iOS won't proceed past "Build Your Project" in Fabric app
The "Exiting because upload-symbols was run in validation mode" message is a bit misleading because it also appears when everything works... I'm using the latest Firebase Crashlytics 4.0.0, but it produces exactly the same output as the older Fabric scripts.
The comments in
${PODS_ROOT}/FirebaseCrashlytics/run
explain it well:
# run
#
# This script is meant to be run as a Run Script in the "Build Phases" section
# of your Xcode project. It sends debug symbols to symbolicate stacktraces,
# sends build events to track versions, and onboards apps for Crashlytics.
#
# This script calls upload-symbols twice:
#
# 1) First it calls upload-symbols synchronously in "validation" mode. If the
# script finds issues with the build environment, it will report errors to Xcode.
# In validation mode it exits before doing any time consuming work.
#
# 2) Then it calls upload-symbols in the background to actually send the build
# event and upload symbols. It does this in the background so that it doesn't
# slow down your builds. If an error happens here, you won't see it in Xcode.
#
# You can find the output for the background execution in Console.app, by
# searching for "upload-symbols".
#
# If you want verbose output, you can pass the --debug flag to this script
Just a reminder: if you want to see the messages in Console.app, start the app first...
I had this problem and I solved it by checking the "Run script only when installing" located near the Build Ph
Chintan from Fabric/Firebase support. Can you check if in the build settings,
DWARF with dSYM
files has been selected as your
Debug Information Format
Also, delete the app from the device / simulator, clean the project, rebuild, run and install the app again. Contact support(at)fabric(dot)io if this doesn't work, your app might need manual activation.
As #llude mention, in order to send the DYSM to FirebaseCrashlytics you only need to add one line in the Code build phases script: ${PODS_ROOT}/FirebaseCrashlytics/run
As mentioned in the setup guide:
https://firebase.google.com/docs/crashlytics/get-started?platform=ios#initialize-crashlytics
note that you will need to add 2 fields as input files (in the build phase script) in order for the update-symbols to send the DYSM file:
plist file path
dysm file path

Error while trying to run script in Xcode for firebase crash reporting

I am trying to integrate the crash reporting of firebase in my project. Though I am successfully getting the crash report in the firebase console I seem to get these 3 errors:
/Users/human/Library/Developer/Xcode/DerivedData/DummyProject-cousedziotoermfdyvgdmbmchdta/Build/Intermediates/DummyProject.build/Debug-iphoneos/DummyProject.build/Script-45E477EF1D33D4631052B160.sh:
line 3: /Users/human/DummyProject/ServiceAccount.json:
Permission denied
cat: : No such file or directory
Command /bin/sh emitted errors but did not return a nonzero exit code
to indicate failure
How do I resolve these errors?
I followed these instructions in firebase
Try the following:
Replace the Run Script build phase you added in Step 3b of the instructions with the simplified:
"${PODS_ROOT}"/FirebaseCrash/upload-sym
In short, delete everything but the last line. This will put upload-sym in interactive mode. If you did not use Cocoapods to install FirebaseCrash, use the full path to the upload-sym script where you installed the framework.
Delete any cached credentials you may have accidentally added:
/bin/rm -f $HOME/Library/Preferences/com.google.SymbolUpload.plist
/bin/rm -f $HOME/Library/Preferences/com.google.SymbolUploadToken.plist
Do a build. When the Run Script build phase starts, you will be prompted with a dialog for the location of the JSON credential file you downloaded in Step 1 of the instructions. You will only be prompted once. Future builds will have the information in the credential cache. If you have permission problems, make sure you have the right JSON file and repeat step 2 above.
What is your "Debug Information Format" set to in your Xcode Build Options? If it’s set to only "DWARF" it will show this erros during build. You could set to "DWARF with dSYM File" errors should disappear.

Resources