locked
Could you provide the details of how to setup Crashlytics in Xamarin (Android and IOS). RRS feed

  • Question

  • User283662 posted

    I am very new to Xamarin and having a hard time setting up Crashlytics. Any help would be appreciated.

    Thursday, December 15, 2016 10:48 AM

All replies

  • User279960 posted

    Did you get yout goal? I need to set up Crashlytics on Xamarin.Android. Any help?

    Saturday, February 11, 2017 4:43 PM
  • User21936 posted

    Please look over this forum thread to see if it helps: https://forums.xamarin.com/discussion/68256/fabric-crashlytics-answers-and-digits-for-xamarin-forms-xamarin-android-and-xamarin-ios

    Monday, February 13, 2017 9:42 PM
  • User85026 posted

    I have just gotten Crashlytics fully working with the iOS version of my Xamarin Forms app using XS on a Mac. To do so I did the following:

    1) I started with an account on Fabric.io

    2) using Xcode locally, I created an application with the same bundle id as used by my Xamarin app. Then, after downloading the Fabric Mac app from https://fabric.io/downloads/apple , I went thru the app's Crashlytic Kit's on-boarding process. The big thing to take away from this process was the shorter of the two alphanumeric strings (the first argument) used in the Xcode build phase run script it presents to you.

    3) I installed in the iOS project of my app the NuGet package from MonoTouch.Fabric.Crashlytics

    4) in AppDelegate.cs, I added the following lines after the global::Xamarin.Forms.Forms.Init (); line. Obviously you'll need to plug the alphanumeric string associated with your app in to the apikey string below.

    string apikey = "<first (and shorter) alphanumeric string from the run phase script arguments>"
    MonoTouch.Fabric.Crashlytics.Crashlytics.StartWithAPIKey(apikey);
    

    5) I added a 'force crash' button for testing using IoC (AutoFac in my case) or a Dependency service to provide access to

        MonoTouch.Fabric.Crashlytics.Crashlytics.SharedInstance.Crash();
    

    in your app's user interface. I only guessed this call was right but it definitely caused a crash on command!

    6) Crashlytics relies on having a dSYM file for your app. It seems to be only generated for builds targeting actually devices (not the simulator) where the IOS Project's Options->IOS IPA Option page has the "Build iTunes Package Archive (IPA)" button checked

    7) in the iOS Projects Options->Custom Command page, I added a command for running "After Build" that is

    /bin/bash <path to script>/transferDsymFile.bash -v
    

    with the Working Directory set to ${TargetDir}.

    I also ticked the box that said "Run on External Console". Thus, after every build, I am given the option in a pop up window to upload the symbol files or not. If you want to always upload the dSYM files, just leave off the -v argument to the transferDsymFile.bash script and untick the external console box.

    I also chose to copy the file "upload-symbols", from the downloaded (in step 2 above) Fabric.app/Contents/MacOS directory (assessable using 'ls' in a terminal window on my Mac though not in Finder!), in to the same directory as the transferDsymFile.bash file so everything was easily locatable by my script (and in my case kept in Git with the rest of my app).

    The contents of my simple transferDsymFile.bash script is (though you'd need to edit to plug in the appropriate key string for your app):

    !/bin/bash

    vflag=0 SCRIPT_DIRNAME=dirname $0

    while [[ $# -gt 0 ]] do key="$1"

    case $key in -v|--verify) vflag=1 shift # past argument ;; esac shift # past argument or value done

    if [ ${vflag} -eq 1 ]; then read -p "Upload dSYM files ? " prompt if [[ $prompt =~ yY* ]] then find . -name ".dSYM" -depth 1 | xargs -I {} ${SCRIPT_DIRNAME}/upload-symbols -a -p ios {} fi else find . -name ".dSYM" -depth 1 | xargs -I {} ${SCRIPT_DIRNAME}/upload-symbols -a -p ios {} fi

    8) with this all done, when either I get a real crash or simulate one with my "crash" button, and the symbols have been uploaded, I get an email saying there is a crash to look at. In the Fabric.io dashboard, I get to see the crashes and can select one of them to see the stack trace that relates to it. Amazing service and capability being offered by Fabric for free!

    It was also neat to see after the first crash was sent to Fabric.io, they started displaying my app's icon on their dashboard and other app related pages automatically.

    One last note, the upload of the crash information from an app crash apparently doesn't occur until the NEXT time the app is run. The crash itself didn't seem to send anything.

    Next up, Android ....

    Thursday, February 16, 2017 7:02 PM
  • User85026 posted

    I have just gotten Crashlytics fully working with the iOS version of my Xamarin Forms app using XS on a Mac. To do so I did the following:

    1) I started with an account on Fabric.io

    2) using Xcode locally, I created an application with the same bundle id as used by my Xamarin app. Then, after downloading the Fabric Mac app from https://fabric.io/downloads/apple , I went thru the app's Crashlytic Kit's on-boarding process. The big thing to take away from this process was the shorter of the two alphanumeric strings (the first argument) used in the Xcode build phase run script it presents to you.

    3) I installed in the iOS project of my app the NuGet package from MonoTouch.Fabric.Crashlytics

    4) in AppDelegate.cs, I added the following lines after the global::Xamarin.Forms.Forms.Init (); line. Obviously you'll need to plug the alphanumeric string associated with your app in to the apikey string below.

    string apikey = "<first (and shorter) alphanumeric string from the run phase script arguments>"
    MonoTouch.Fabric.Crashlytics.Crashlytics.StartWithAPIKey(apikey);
    

    5) I added a 'force crash' button for testing using IoC (AutoFac in my case) or a Dependency service to provide access to

        MonoTouch.Fabric.Crashlytics.Crashlytics.SharedInstance.Crash();
    

    in your app's user interface. I only guessed this call was right but it definitely caused a crash on command!

    6) Crashlytics relies on having a dSYM file for your app. It seems to be only generated for builds targeting actually devices (not the simulator) where the IOS Project's Options->IOS IPA Option page has the "Build iTunes Package Archive (IPA)" button checked

    7) in the iOS Projects Options->Custom Command page, I added a command for running "After Build" that is

    /bin/bash <path to script>/transferDsymFile.bash -v
    

    with the Working Directory set to ${TargetDir}.

    I also ticked the box that said "Run on External Console". Thus, after every build, I am given the option in a pop up window to upload the symbol files or not. If you want to always upload the dSYM files, just leave off the -v argument to the transferDsymFile.bash script and untick the external console box.

    I also chose to copy the file "upload-symbols", from the downloaded (in step 2 above) Fabric.app/Contents/MacOS directory (assessable using 'ls' in a terminal window on my Mac though not in Finder!), in to the same directory as the transferDsymFile.bash file so everything was easily locatable by my script (and in my case kept in Git with the rest of my app).

    The contents of my simple transferDsymFile.bash script is (though you'd need to edit to plug in the appropriate key string for your app):

    !/bin/bash

    vflag=0 SCRIPT_DIRNAME=dirname $0

    while [[ $# -gt 0 ]] do key="$1"

    case $key in -v|--verify) vflag=1 shift # past argument ;; esac shift # past argument or value done

    if [ ${vflag} -eq 1 ]; then read -p "Upload dSYM files ? " prompt if [[ $prompt =~ yY* ]] then find . -name ".dSYM" -depth 1 | xargs -I {} ${SCRIPT_DIRNAME}/upload-symbols -a -p ios {} fi else find . -name ".dSYM" -depth 1 | xargs -I {} ${SCRIPT_DIRNAME}/upload-symbols -a -p ios {} fi

    8) with this all done, when either I get a real crash or simulate one with my "crash" button, and the symbols have been uploaded, I get an email saying there is a crash to look at. In the Fabric.io dashboard, I get to see the crashes and can select one of them to see the stack trace that relates to it. Amazing service and capability being offered by Fabric for free!

    It was also neat to see after the first crash was sent to Fabric.io, they started displaying my app's icon on their dashboard and other app related pages automatically.

    One last note, the upload of the crash information from an app crash apparently doesn't occur until the NEXT time the app is run. The crash itself didn't seem to send anything.

    Next up, Android ....

    Thursday, February 16, 2017 7:02 PM
  • User364988 posted

    @MichelMoreira @chairmanMal
    Your instructions were very helpful, I managed to upload the dSym files to the point that there's no 'missing symbols' warning anymore and some crash information is displayed. However, it is not really my crash. No matter how I cause the crash, the stack trace I see is related to Xamarin only, not my custom classes, for example:

    XamarinFormsEventTriggerAttachHandlerToXamarinFormsBindableObject (D:\agent_work\2\s\Xamarin.Forms.Core\Interactivity\EventTrigger.cs:68)

    with the last message being

    Crashed: tidb07 EXCBADACCESS KERNINVALID_ADDRESS 0x0000000000000000

    Did something like this ever happen to you? What could be missing?

    Saturday, January 27, 2018 6:06 AM
  • User85026 posted

    First of all I never worked on the Android version.

    For iOS, I do get my symbols. I am not sure what would be the cause of what you are seeing but I notice in the iOS project's options file on VS, I see I set, under Compiler->Debugging Information "full" and under iOS Build I did NOT tick "strip native debugging information" and on iOS Debug I ticked "Enable Debug". I also on iOS IPA Options have ticked "Build iTunes Package Archive". Hope that helps!

    Wednesday, March 7, 2018 8:10 PM
  • User244153 posted

    Anyone knows if Xamarin team is creating official support for Firebase Crashlytics?

    Thursday, March 22, 2018 11:38 PM
  • User370867 posted

    @chairmanMal When I try to run your script, it just writes "logout" to the terminal.

    Also which key do you mean? the API key or the long key?

    Tuesday, July 17, 2018 2:54 PM
  • User207209 posted

    @randalvance said: Anyone knows if Xamarin team is creating official support for Firebase Crashlytics?

    I'm also interested in Firebase Analytics. Actually, I've imported the NuGet package Xamarin.Firebase.iOS.Crashlytics but I get an error of kind:

    /Users/David/.nuget/packages/xamarin.firebase.ios.crashlytics/3.10.1/build/Xamarin.Firebase.iOS.Crashlytics.targets(3,3): Error MSB3073: The command "/Users/David/Library/Caches/XamarinBuildDownload/Fbrc-1.7.5/upload-symbols -gsp /Users/David/Xamarin Projects/DND/MyApp/MyApp.iOS/GoogleService-Info.plist -p ios bin/iPhone/Debug/device-builds/iphone7.2-11.4.1/MyApp.iOS.app.dSYM" exited with code 132. (MSB3073) (MyApp.iOS)

    Any idea or tutorial?

    Thursday, July 26, 2018 1:32 PM
  • User365065 posted

    @DavidDupuis said: Actually, I've imported the NuGet package Xamarin.Firebase.iOS.Crashlytics but I get an error of kind:

    /Users/David/.nuget/packages/xamarin.firebase.ios.crashlytics/3.10.1/build/Xamarin.Firebase.iOS.Crashlytics.targets(3,3): Error MSB3073: The command "/Users/David/Library/Caches/XamarinBuildDownload/Fbrc-1.7.5/upload-symbols -gsp /Users/David/Xamarin Projects/DND/MyApp/MyApp.iOS/GoogleService-Info.plist -p ios bin/iPhone/Debug/device-builds/iphone7.2-11.4.1/MyApp.iOS.app.dSYM" exited with code 132. (MSB3073) (MyApp.iOS)

    I had this same problem, and finally found out that it as because of a space in the route. If you double click on it, it will open Xamarin.Firebase.iOS.Crashlytics, and here you can add single quotes to this part to fix it:

    '$(MSBuildProjectDirectory)\GoogleService-Info.plist'

    Thursday, August 23, 2018 6:57 PM
  • User278535 posted

    I would like you (or anyone capable) to clarify a few things please.

    @chairmanMal said: 7) in the iOS Projects Options->Custom Command page, I added a command for running "After Build" that is

    /bin/bash path to script/transferDsymFile.bash -v

    I assume I have to replace path to script with my actual path to the script, which in this case is the iOS project directory?

    The contents of my simple transferDsymFile.bash script is (though you'd need to edit to plug in the appropriate key string for your app):

    key="$1"

    What key string are you referring to? Is this the app's bundle identifier?

    Thursday, August 30, 2018 10:53 PM
  • User281255 posted

    I needed to fix a few things wrong with the above script.

    1) wrap dirname $0 with $() like this $(dirname $0) 2) find should use a wildcard like this "*.dSYM" 3) api key needs adding after the upload-symbols -a argument

    Using the below script you only need to replace _YOUR_API_KEY_GOES_HERE_ with your crashlytics API key

    more info on the fabric website https://docs.fabric.io/apple/crashlytics/missing-dsyms.html#upload-symbols

    ```

    !/bin/bash

    vflag=0 SCRIPT_DIRNAME=$(dirname $0)

    while [[ $# -gt 0 ]] do key="$1"

    case $key in -v|--verify) vflag=1 shift # past argument ;; esac shift # past argument or value done

    if [ ${vflag} -eq 1 ]; then read -p "Upload dSYM files ? " prompt if [[ $prompt =~ yY* ]] then find . -name ".dSYM" -depth 1 | xargs -I {} ${SCRIPT_DIRNAME}/upload-symbols -a "_YOUR_API_KEY_GOES_HERE_" -p ios {} fi else find . -name ".dSYM" -depth 1 | xargs -I {} ${SCRIPTDIRNAME}/upload-symbols -a "YOURAPIKEYGOESHERE_" -p ios {} fi ```

    Sunday, September 23, 2018 4:36 PM
  • User378910 posted

    @cbinceptio

    @cbinceptio said:

    @DavidDupuis said: Actually, I've imported the NuGet package Xamarin.Firebase.iOS.Crashlytics but I get an error of kind:

    /Users/David/.nuget/packages/xamarin.firebase.ios.crashlytics/3.10.1/build/Xamarin.Firebase.iOS.Crashlytics.targets(3,3): Error MSB3073: The command "/Users/David/Library/Caches/XamarinBuildDownload/Fbrc-1.7.5/upload-symbols -gsp /Users/David/Xamarin Projects/DND/MyApp/MyApp.iOS/GoogleService-Info.plist -p ios bin/iPhone/Debug/device-builds/iphone7.2-11.4.1/MyApp.iOS.app.dSYM" exited with code 132. (MSB3073) (MyApp.iOS)

    I had this same problem, and finally found out that it as because of a space in the route. If you double click on it, it will open Xamarin.Firebase.iOS.Crashlytics, and here you can add single quotes to this part to fix it:

    '$(MSBuildProjectDirectory)\GoogleService-Info.plist'

    This didn't work for me, I have the exact same problem and couldn't build for release because of this. I didn't have this problem before and I think it is due to new os Mojave?

    I hope anyone can help me.

    Wednesday, October 24, 2018 4:15 AM
  • User365065 posted

    @allandalehojcc said: This didn't work for me, I have the exact same problem and couldn't build for release because of this. I didn't have this problem before and I think it is due to new os Mojave?

    I hope anyone can help me.

    Actually, this error has been solved since version 3.10.3.1, and it shouldn't be happening. Also, I'm using Mojave as well and I haven't had any problem with it. Are you having the same exact error that we did before?

    Wednesday, October 24, 2018 10:16 PM
  • User378910 posted

    @cbinceptio said:

    @allandalehojcc said: This didn't work for me, I have the exact same problem and couldn't build for release because of this. I didn't have this problem before and I think it is due to new os Mojave?

    I hope anyone can help me.

    Actually, this error has been solved since version 3.10.3.1, and it shouldn't be happening. Also, I'm using Mojave as well and I haven't had any problem with it. Are you having the same exact error that we did before?

    Yes, I'm still having the same error. I have only updated Xamarin.Firebase.iOS.Crashlytics, not sure if any other packages requires update?

    Also after doing some research, there are more people having the same issue in GitHub also.(from gitHub.com//xamarin/GoogleApisForiOSComponents/issues/194).

    I'm stuck with this problem for a few days now, hopefully someone can help or produce steps on how to fix the issue.

    Tuesday, October 30, 2018 1:59 AM
  • User293999 posted

    You can check my blog here, where i have added everything you need to setup Crashlytics in Xamarin Android and iOS https://medium.com/@hakimgulamali88/firebase-crashlytics-with-xamarin-5421089bb561

    Tuesday, October 22, 2019 8:03 PM