When user configures multi-environment (e.g development, production, etc) , it breaks de-obfuscation of stack traces on the Firebase console. It works fine when using default Firebase app configuration. Not sure if this is a result of the upload-symbols
script on firebase-ios-sdk's FirebaseCrashlytics pod or an issue on Firebase console.
- Clone this repository.
- Run
flutter pub get
in root of project. - Run
cd ios
&&xed .
to open Xcode and ensure code signing is setup appropriately for your Apple account. - Install FlutterFire CLI (If you have it installed already , drop the
--overwrite
argument).
dart pub global activate flutterfire_cli 0.3.0-dev.19 --overwrite
- Run cd
..
to get back to root of project. - Run configuration command to configure Firebase iOS app (be sure to use your own Firebase project):
flutterfire configure --yes --project=[FIREBASE PROJECT NAME] --platforms=ios --ios-build-config=Debug-development --ios-bundle-id=com.example.verygoodcore.crashlytics-symbols.dev --ios-out=ios/development-environment
- Run the app:
flutter run --debug --flavor=development --target=lib/main_production.dart
- Press the button
Test Crashlytics reproduction
a couple of times. - Head over to the Firebase console and open the relevant app in the crashlytics part and see the crash reports and stack traces.
- Configure app for the build type "release" and flavor "production" (be sure to use your own Firebase project):
flutterfire configure --yes --project=[FIREBASE PROJECT NAME] --platforms=ios --ios-build-config=Release-production --ios-bundle-id=com.example.verygoodcore.crashlytics-symbols --ios-out=ios/release-environment
- Build app and obfuscate (be sure to update
--split-debug-info
argument):
flutter build ios --flavor=production --release --obfuscate --split-debug-info=[ABSOLUTE PATH TO A DIRECTORY IN THE PROJECT] --target=lib/main_production.dart --verbose | tee release.logs
The above command will also create a "release.logs" with all the Xcode build logs for viewing. You can see the logs contain output which indicates uploading the symbols was a success.
- Connect your iPhone and install the just created built app on your device:
flutter install --flavor=production --release
This will install the app on your phone. Open it and press the button Test Crashlytics reproduction
to send crash reports (should occur immediately as they are set to "fatal").
Open the Firebase console and see that the dSYMs have been uploaded successfully (You can check the debug symbol ID in the console against the ID that was output in the "release.logs").
The stack traces are not deobfuscated. This is the issue
- You can check the stack trace is successfully deobfuscated. Grab the
TXT
version of an obfuscated stack trace from the Firebase console for thecom.example.verygoodcore.crashlytics-symbols
app and create a new file in the project, paste into a file calledstacktrace.txt
. Now run this command (be sure to update the path specified earlier for "--split-debug-info" argument):
flutter symbolize -i stacktrace.txt -d [PATH TO "--split-debug-info" ARG SPECIFIED EARLIER]/app.ios-arm64.symbol]
You will see it successfully de-obfuscate the stack trace.
- If you want to see what FlutterFire is running under the hood and the arguments it is passing to the environment variables. You can check out the script in "script/upload.dart" in this project. Here is how you can populate the arguments in that script:
- Clone the FlutterFire CLI repository and checkout this PR. This PR prints out the arguments passed to the script that uploads the debug symbols.
- From the root of the FlutterFire CLI, run
dart pub global activate --source="path" . --executable="flutterfire" --overwrite
which will now point to the local version of FlutterFire CLI. - From within the project, run the same build command from earlier (be sure to update
--split-debug-info
argument):
flutter build ios --flavor=production --release --obfuscate --split-debug-info=[ABSOLUTE PATH TO A DIRECTORY IN THE PROJECT] --target=lib/main_production.dart --verbose | tee release.logs
- Now check out "release.logs" which will print out all the arguments passed to the script which you can copy/paste into the variables in
script/upload.dart
. - You can now run
dart script/upload.dart
to replicate what FlutterFire CLI is doing under the hood. You can also check the path variables are correct by rooting to them from your terminal. They all appear to be correct.