Kiran Sarvaiya
Kiran Sarvaiya

Reputation: 1428

How to upload dsyms files which developed with Flutter?

I am developing one Cross-platform app with flutter support. I Integrated firebase Crashlytics for crash reports. before I need to check report one error message comes

Upload 1 missing dSYM required to process 4 crashes

for that, I tried firebase docs

Get deobfuscated crash reports

also, I followed steps to build iOS Archive with flutter

Preparing an iOS App for Release

Still, There is the same issue on firebase portal

Upload 1 missing dSYM required to process 4 crashes

I tried this many times but still not done yet.

If someone has Idea then please help me to fix this issue.

Thanks, Community

Upvotes: 40

Views: 27324

Answers (9)

Niraj Shah
Niraj Shah

Reputation: 15457

After building an Archive of your Flutter app (using Xcode), you can run the following command from your Flutter App's ios directory (using Firebase's upload tool):

Pods/FirebaseCrashlytics/upload-symbols -gsp /path/to/GoogleService-Info.plist -p ios /path/to/Runner.xcarchive/dSYMs

Change the above command line to point to the correct Firebase plist file. the -p flag specifies platform (which can be ios, mac, or tvos). The above command will also look for the App's archive file Runner.xcarchive.

Upvotes: 10

bidhan skybase
bidhan skybase

Reputation: 41

Preparing a dSYM file

In most cases when you are working in Crashlytics in Firebase, you are required to upload a dSYM file. Here's how you can prepare the dSYM file.

  1. In your Flutter project navigate to your iOS file from command-line.

  2. type cd/ios and open Runner.xcworkspace. This will launch Xcode.

  3. Select Runner from the left side and navigate to Debug Information Format inside Build Settings.

  4. Change everything to DWARF with dSYM File.

  5. Archive the project and select the recent archive inside Organizer.

  6. Left click the recent archive and choose Show in Finder option.

  7. Left click again and pick Show Package Contents.

  8. Compress all the dSYM file into one zip file and upload it in Firebase.

Note: You will need a Mac to do all of the above.

Upvotes: 4

Diego Alvarez
Diego Alvarez

Reputation: 11

I had this issue and none of the above worked for me. I'm using flutter 3.24.1 and firebase_crashlytics 3.5.7 with firebase_core 2.24.2.

What worked for me was to create the following script as the last script to run on build phases in XCode. So try using the following steps:

  1. Create a new script on build phases (XCode>targets>runner>Build Phases> + )

  2. Copy and paste the following as-is in the shell space:

"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/Runner/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"

  1. In the Input Files section copy and past the following one by one as-is:

${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME} ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${PRODUCT_NAME} ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist $(BUILT_PRODUCTS_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/GoogleService-Info.plist $(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)

  1. That's it. Build to test and if needed run in release mode.

Upvotes: 1

vladli
vladli

Reputation: 1573

With recent version of flutter/crashlytics, adding

-ai "[App ID]"

into

Runner -> Build Phases -> [firebase_crashlytics] Crashlytics Upload Symbols

was the only thing that was needed in my case.

Full line looks like this:

"$PODS_ROOT/FirebaseCrashlytics/upload-symbols" --flutter-project "$PROJECT_DIR/firebase_app_id_file.json" -ai "1:my_apple_app_id"

Flutter 3.16.5

firebase_crashlytics: ^3.4.9

Docs: https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=flutter

Upvotes: 0

Brendan
Brendan

Reputation: 1167

OPTION 1

I use this Run Script to automate the process

if [ "${CONFIGURATION}" = "Release" ]; then
    GOOGLESERVICE_INFO_PLIST=GoogleService-Info.plist
    GOOGLESERVICE_INFO_FILE="/path/to/GoogleService-Info.plist"
    # (Usually "${PROJECT_DIR}/Runner/GoogleService-Info.plist")

    if [ -f "$GOOGLESERVICE_INFO_FILE" ]; then
        echo "Using GoogleService-Info.plist from ${GOOGLESERVICE_INFO_FILE}"

        # Get GOOGLE_APP_ID from GoogleService-Info.plist file
        APP_ID="$(grep -A1 GOOGLE_APP_ID ${GOOGLESERVICE_INFO_FILE} | tail -n1 | sed -e 's/.*\<string\>\(.*\)\<\/string\>/\1/')"

        # Run scripts to upload dSYMs to Firebase crashlytics
        "$PODS_ROOT/FirebaseCrashlytics/run" -ai "${APP_ID}"
        "$PODS_ROOT/FirebaseCrashlytics/upload-symbols" --build-phase --validate -ai "${APP_ID}"
        "$PODS_ROOT/FirebaseCrashlytics/upload-symbols" --build-phase -ai "${APP_ID}"
        "$PODS_ROOT/FirebaseCrashlytics/upload-symbols" -gsp "${GOOGLESERVICE_INFO_FILE}" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"  -ai "${APP_ID}"
        
        echo "Successfully uploaded dSYMs to Firebase Crashlytics!"
    else
        echo "GoogleService-Info.plist not found in ${GOOGLESERVICE_INFO_FILE}"
    fi
fi

OPTION 2

However, if you're like me and you have build schemes for your app (like Release-dev, Release-prod, Release-beta); then do this instead,

  1. Ensure you have setup your build schemes correctly, else the next steps will probably not work for you. PS: I use this medium post.

  2. Ensure you have GoogleService-Info.plist for each scheme in separate folders; IMPORTANT: Your folder structure should look something like this:

config
  |
  |
   --- dev -- GoogleService-Info.plist
  |
  |
   --- beta -- GoogleService-Info.plist
  |
  |
   --- prod -- GoogleService-Info.plist
  1. Ensure you have enabled dSYM for Release builds under: Targets -> Runner -> Build Settings -> Build Options -> Debug Information Format. Should be set to DWARF with dSYM File

Enable dSYMs for Release build

  1. Then add a Run Script with name [firebase_crashlytics] Upload dSYMs to Firebase Crashlytics (or whatever).

  2. Copy & paste the below in the script section:

if [ "${CONFIGURATION}" = "Release" ]; then
    environment="default"

    # Set the current build environment / scheme
    if [[ $CONFIGURATION =~ -([^-]*)$ ]]; then
        environment=${BASH_REMATCH[1]}
    fi

    GOOGLESERVICE_INFO_PLIST=GoogleService-Info.plist

    # And here you can see why that folder structure is important.
    GOOGLESERVICE_INFO_FILE=${PROJECT_DIR}/config/${environment}/${GOOGLESERVICE_INFO_PLIST}

    if [ -f "$GOOGLESERVICE_INFO_FILE" ]; then
        echo "Using GoogleService-Info.plist from ${GOOGLESERVICE_INFO_FILE}"

        # Get GOOGLE_APP_ID from GoogleService-Info.plist file
        APP_ID="$(grep -A1 GOOGLE_APP_ID ${GOOGLESERVICE_INFO_FILE} | tail -n1 | sed -e 's/.*\<string\>\(.*\)\<\/string\>/\1/')"

        # Run scripts to upload dSYMs to Firebase crashlytics
        "${PODS_ROOT}/FirebaseCrashlytics/run" -ai "${APP_ID}"
        "$PODS_ROOT/FirebaseCrashlytics/upload-symbols" --build-phase --validate -ai "${APP_ID}"
        "$PODS_ROOT/FirebaseCrashlytics/upload-symbols" --build-phase -ai "${APP_ID}"
        "${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${GOOGLESERVICE_INFO_FILE}" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"  -ai "${APP_ID}"
        
        echo "Successfully uploaded dSYMs to Firebase Crashlytics!"
    else
        echo "GoogleService-Info.plist not found in ${GOOGLESERVICE_INFO_FILE}"
    fi
fi
  1. In the Input Files section, add the paths for the locations of the following files:
    • The location of your project's dSYM files: ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}
    • The location of your project's built Info.plist file: $(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

Input Files section

See the Firebase docs for more info

That's all!

Upvotes: 5

Andrey Gordeev
Andrey Gordeev

Reputation: 32529

Currently, a recommended approach is to add a Run Script Phase that uploads dSYMs to Crashlytics on every build.

  1. From Xcode, select Runner from the project navigation.
  2. Select the Build Phases tab, then click + > New Run Script Phase.
  3. Add the following to the Type a script... text box underneath the Shell property:
$PODS_ROOT/FirebaseCrashlytics/upload-symbols --build-phase --validate -ai <googleAppId>
$PODS_ROOT/FirebaseCrashlytics/upload-symbols --build-phase -ai <googleAppId>

Retrieve your <googleAppId> from your generated DefaultFirebaseOptions file (appId) or from the Firebase Console -> Project Settings -> Your apps.

enter image description here

Taken from here

Upvotes: 3

bikram
bikram

Reputation: 7985

Let your Xcode upload it automatically when you run/build your app.

I. Open Xcode > Targets > MyProjectName > Build phases

Add two scripts (using + sign) consisting of each of these

  1. "${PODS_ROOT}/FirebaseCrashlytics/run"

  2. "${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/MyProjectName/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"

Important: Make sure to replace MyProjectName with your project name but leave rest as it is.

II. Also make sure to check these options in Targets > MyProjectName > Build settings

Set Debug information format to DWARF with dSYM file

III. Visuals enter image description here enter image description here enter image description here enter image description here

Upvotes: 43

Yilmaz Guleryuz
Yilmaz Guleryuz

Reputation: 9755

you can use Fastlane to automate also this as part of release process. here's an example that can go into your Fastfile

platform :ios do
  desc "Upload symbols to Crashlytics"
  lane :toCrashlytics do
    upload_symbols_to_crashlytics
  end
end

then you can run fastlane ios toCrashlytics to run it.

see this link for more details.

Upvotes: 9

Emmett Deen
Emmett Deen

Reputation: 731

When preparing my app for release I take these steps to export, upload, and get the dSYM's:

  1. In terminal I run 'flutter build ios --release'
  2. Open the iOS project in xCode and switch the device to 'Generic iOS Device'
  3. From the top menu Product>Archive
  4. Once finished the Organizer window will show your archived build. You can also manually open this window from Window>Organizer
  5. Choose the build you want to upload to iTunes Connect and hit Distribute App and follow the process
  6. After upload is complete right click on the build in the organizer window and click 'Show in Finder'
  7. You should see an archive file in finder, right-click it and click 'Show Package Contents'.
  8. Inside there should be a folder called dSYM that you can zip and send wherever you need

Upvotes: 26

Related Questions