Search code examples
iosswiftfirebasefirebase-crash-reporting

iOS Firebase Crash Reporting - Error running build script


I get the following error when running the script to upload symbol files (everytime I try and build my project):

upload-sym-util.bash:351: error: symbolFileUploadLocation: The API Key and the authentication credential are from different projects.

Here is my build script:

if [ "$CONFIGURATION" == "Debug" ]; then
    GOOGLE_APP_ID=<app-id>
    "${PODS_ROOT}"/FirebaseCrash/upload-sym "${SRCROOT}"/<app>/Firebase/CrashReportingKey-Dev.json
else
    GOOGLE_APP_ID=<app-id>
    "${PODS_ROOT}"/FirebaseCrash/upload-sym "${SRCROOT}"/<app>/Firebase/CrashReportingKey.json
fi

Things I've done/checked:

  1. The GOOGLE_APP_ID and CrashReportingKey*.json are associated with the same project.
  2. My GoogleService-Info*.plist files have the API_KEY field.
  3. Checking "Run script only when installing" box, which allows me to run the app, but doesn't actually run the script in a development environment. So crashes are sent to Firebase, but they aren't symbolicated.

I'm open to any ideas. Thanks!


Solution

  • You are correct that there's no way to override the GoogleService-Info.plist. However there's still a way to override the pieces of information the upload script uses from that file.

    1. Open the GoogleService-Info.plist corresponding to the .json.
    2. Search for GOOGLE_APP_ID and API_KEY.
    3. Adjust the build script like so:

      export FIREBASE_APP_ID=<GOOGLE_APP_ID>
      export FIREBASE_API_KEY=<API_KEY>
      
      "${PODS_ROOT}"/FirebaseCrash/upload-sym "ServiceAccount.json"
      

    In your case, your final script should look something like:

        if [ "$CONFIGURATION" == "Debug" ]; then
            export FIREBASE_APP_ID=<app-id>
            export FIREBASE_API_KEY=<API_KEY for dev>
            "${PODS_ROOT}"/FirebaseCrash/upload-sym "${SRCROOT}"/<app>/Firebase/CrashReportingKey-Dev.json
        else
            export FIREBASE_APP_ID=<app-id>
            export FIREBASE_API_KEY=<API_KEY for release>
            "${PODS_ROOT}"/FirebaseCrash/upload-sym "${SRCROOT}"/<app>/Firebase/CrashReportingKey.json
        fi