31

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

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Kiran Sarvaiya
  • 1,318
  • 1
  • 13
  • 37
  • You should find `the Runner.app.dSYM.zip` inside the `ios` directory. It is generated by the `flutter build ios` command for release builds, assuming Crashlytics was setup correctly. – Sakchham Apr 16 '19 at 18:55
  • I also tried this but not done. – Kiran Sarvaiya Apr 17 '19 at 04:55
  • How are you generating release packages? – Sakchham Apr 17 '19 at 07:34
  • 1
    using On the command line, follow these steps in your application directory: Run flutter build ios to create a release build (flutter build defaults to --release). To ensure that Xcode refreshes the release mode configuration, close and re-open your Xcode workspace. For Xcode 8.3 and later, this step is not required. – Kiran Sarvaiya Apr 17 '19 at 09:15

6 Answers6

34

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

bikram
  • 7,127
  • 2
  • 51
  • 63
  • I did exact same config as you but I still got the warning in firebase console... Any idea what can possibly go wrong? – Milvintsiss May 19 '21 at 01:30
  • 3
    NB: it's `"${PROJECT_DIR}/Runner/GoogleService-Info.plist"` and not `"${PROJECT_DIR}/MyProjectName/GoogleService-Info.plist"` (your screenshot is good) – Milvintsiss May 19 '21 at 01:32
  • @Milvintsiss The screenshot is an example of the project name "Runner" so that makes it relevant. – bikram May 19 '21 at 04:46
  • oh I'm learning something, I never did an iOS project without Flutter so I was thinking that "Runner" was like the "app" folder in Android and that it cannot have another name ^^ – Milvintsiss May 19 '21 at 13:21
  • 4
    This no longer works, since you initialize firebase with the flutterfire CLI. Since no `GoogleService-Info.plist` is used anymore, I tried using exchanging `-gsp "[Path to file]"` with `-ai "[App ID]"`. But i still get the following error: `error: Could not get GOOGLE_APP_ID in Google Services file from build environment`. Does anyone know how I can fix this? – Hannes Hultergård Dec 30 '21 at 16:46
  • 2
    Okay, I figured it out myself. You have to add `-ai "[App ID]"` to the first script as well – Hannes Hultergård Dec 31 '21 at 12:03
21

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
Emmett Deen
  • 661
  • 5
  • 17
  • 1
    Right, but how do you know exactly which of them is missing? The name in the Firebase warning is some kind of UUID, but the filenames in the dSYM-folder are normal filenames of plugins etc? – Magnus Jun 01 '23 at 08:35
8

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.

Yilmaz Guleryuz
  • 9,313
  • 3
  • 32
  • 43
6

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 build/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.

Niraj Shah
  • 15,087
  • 3
  • 41
  • 60
3

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!

Brendan
  • 910
  • 1
  • 14
  • 32
  • 1
    Very nice, and I you could make it even simpler by just providing `-gsp "${GOOGLESERVICE_INFO_FILE}"` at each step and not needing `APP_ID`. FYI the -ai flag help states: `Provide your Firebase app id directly without parsing the Google service plist. This flag will supersede the -gsp, --google-service-plist flag.` – qix Nov 30 '22 at 08:58
2

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

Andrey Gordeev
  • 30,606
  • 13
  • 135
  • 162
  • https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=flutter Here's the updated source on how it's done. The link posted on the answer is outdated – douglas.iacovelli Mar 07 '23 at 16:06