invertase / flutterfire_cli

A CLI to help with using FlutterFire in your Flutter applications.
Apache License 2.0
164 stars 47 forks source link

[bug]: flutterfire upload-crashlytics-symbols not working for multi-environment setup #249

Closed stilus-tayyipguzel closed 3 months ago

stilus-tayyipguzel commented 6 months ago

Is there an existing issue for this?

CLI Version

0.3.0-dev.19

Firebase Tools version

13.0.2

Flutter Doctor Output

fvm flutter doctor -v [✓] Flutter (Channel stable, 3.13.6, on macOS 13.3.1 22E261 darwin-arm64, locale en-TR) • Flutter version 3.13.6 on channel stable at /Users/tayyipguzel/fvm/versions/3.13.6 • Upstream repository https://github.com/flutter/flutter.git • Framework revision ead455963c (3 months ago), 2023-09-26 18:28:17 -0700 • Engine revision a794cf2681 • Dart version 3.1.3 • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/tayyipguzel/Library/Android/sdk • Platform android-34, build-tools 33.0.2 • ANDROID_HOME = /Users/tayyipguzel/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E300c • CocoaPods version 1.13.0

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.85.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.78.0

[✓] Connected device (3 available) • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64 • Android 11 (API 30) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.3.1 22E261 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.109

[✓] Network resources • All expected network resources are available.

• No issues found!

Description

I create a new project in flutter version 3.13.6, run the flutterfire configure command and make the necessary installations. Missing dsym files issue seen in firebase. When I check Xcode, I can see the FlutterFire: "flutterfire upload-crashlytics-symbols" script.


#!/bin/bash
PATH=${PATH}:$FLUTTER_ROOT/bin:$HOME/.pub-cache/bin
flutterfire upload-crashlytics-symbols --upload-symbols-script-path=$PODS_ROOT/FirebaseCrashlytics/upload-symbols --platform=ios --apple-project-path=${SRCROOT} --env-platform-name=${PLATFORM_NAME} --env-configuration=${CONFIGURATION} --env-project-dir=${PROJECT_DIR} --env-built-products-dir=${BUILT_PRODUCTS_DIR} --env-dwarf-dsym-folder-path=${DWARF_DSYM_FOLDER_PATH} --env-dwarf-dsym-file-name=${DWARF_DSYM_FILE_NAME} --env-infoplist-path=${INFOPLIST_PATH} --default-config=default

Steps to reproduce

create new flutter project 3.13.6 run flutterfire configure dsym files not uploaded

Expected behavior

dsym files should be loaded successfully.

Screenshots

Screenshot 2023-12-21 at 11 56 02

Additional context and comments

Android is running successfully.

stilus-tayyipguzel commented 6 months ago

https://github.com/stilus-tayyipguzel/crashlytics sample project

russellwheatley commented 6 months ago

@stilus-tayyipguzel - I tested this on two different projects. Can I see the relevant build logs, please? i.e. flutter run --verbose | tee build.log and pipe the output into a file called build.log and show here. If you wish, you can just find the relevant output by searching for upload-symbols.

stilus-tayyipguzel commented 6 months ago

@russellwheatley - build-ios.log

russellwheatley commented 6 months ago

You also have the correct logs from you build that show symbols were uploaded:

Running upload-symbols in Build Phase mode
            Validating build environment for Crashlytics...
            Processing dSYMs...
            Successfully submitted symbols for architecture arm64 with UUID 881d2fa256783e798b21869a95eab860 in dSYM: /Users/tayyipguzel/Desktop/crashapp/build/ios/Debug-iphonesimulator/Runner.app.dSYM
            Successfully uploaded Crashlytics build event and symbols
            Running upload-symbols in Build Phase mode
            Validating build environment for Crashlytics...
            Processing dSYMs...
            Successfully submitted symbols for architecture arm64 with UUID 881d2fa256783e798b21869a95eab860 in dSYM: /Users/tayyipguzel/Desktop/crashapp/build/ios/Debug-iphonesimulator/Runner.app.dSYM
            Successfully uploaded Crashlytics build event and symbols

Not sure what is going wrong then 🤔. Seems your dSYMs are uploaded.

What does it say in Firebase console when you click on dSYMs tab in Crashlytics?

stilus-tayyipguzel commented 6 months ago

Screenshot 2023-12-28 at 14 10 22 (2) Screenshot 2023-12-28 at 14 10 01 (2)

russellwheatley commented 6 months ago

hmmmm, I wonder if it is a difference between debug build and release build? When I was testing, I was using release builds via flutter build ios --obfuscate --split-debug-info=./ios-build. Could you try this and see if this changes anything?

stilus-tayyipguzel commented 6 months ago

@russellwheatley When I ran the project via Xcode after running the command you gave, the dsym files were loaded successfully. Screenshot 2023-12-28 at 15 22 21

russellwheatley commented 6 months ago

did you run it in debug or release mode?

stilus-tayyipguzel commented 6 months ago

I have never used the flutter build ios command before, I ran it directly via Xcode after the command. It runs in debug mode by default.

stilus-tayyipguzel commented 6 months ago

I skipped this step, I dragged and dropped the Runner.app created with the command you gave into the simulator and tried to open it there, but it did not open.

russellwheatley commented 6 months ago

@stilus-tayyipguzel Does this mean the upload worked when you built your app through Xcode and not via flutter run command? Seems a bit odd to me as my testing was purely through the flutter command in VS code terminal.

I am glad it worked for you eventually, just not quite sure why it didn't happen when you built the app via the terminal particularly as your logs show successful upload of symbols.

stilus-tayyipguzel commented 6 months ago

@russellwheatley I have a question, what exactly should I do after running the flutter build ios --obfuscate --split-debug-info=./ios-buildcommand you mentioned in the comment? Runner.app file was created. later? I will test again whether the problem is solved when running with Xcode.

stilus-tayyipguzel commented 6 months ago

@russellwheatley I repeated my previous steps and first ran it in debug mode via vscode. I ran it in debug mode from xcode. Dsym files are not loading at all in my current try. I'm trying by creating a new flutter project and firebase project. You said you tested 2 projects. What steps do you follow when running it?

russellwheatley commented 5 months ago

@russellwheatley I have a question, what exactly should I do after running the flutter build ios --obfuscate --split-debug-info=./ios-buildcommand you mentioned in the comment? Runner.app file was created. later? I will test again whether the problem is solved when running with Xcode.

You need to flutter install to iPhone device.

russellwheatley commented 5 months ago

@russellwheatley I repeated my previous steps and first ran it in debug mode via vscode. I ran it in debug mode from xcode. Dsym files are not loading at all in my current try. I'm trying by creating a new flutter project and firebase project. You said you tested 2 projects. What steps do you follow when running it?

  1. flutter create project
  2. flutter pub add firebase_core firebase_crashlytics
  3. Copy/paste the main.dart file from Flutterfire firebase crashlytics example.
  4. Run flutterfire configure --yes --project=project-id --platforms=ios
  5. Run flutter build ios --obfuscate --split-debug-info=./ios-build
  6. Run flutter install on device.
  7. Run app and press buttons for non-fatal and fatal crashes
  8. Viewed deobfuscated crash reports on the Firebase console
tyypgzl commented 4 months ago

@russellwheatley

Screenshot 2024-02-20 at 17 51 19
RCVZ commented 4 months ago

@russellwheatley I encountered the same problem, which seems to be related to the use of flavors. When I turn off the flavors, the uploaded symbols display the correct version and the stacktraces are deobfuscated.

https://github.com/firebase/flutterfire/issues/12283

AhmedLSayed9 commented 4 months ago

I've also encountered the same issue when using flavors as @RCVZ. I've tried building the app on 2 different devices but still no luck.

techouse commented 4 months ago

Same here. Flavors break it for some reason :(

russellwheatley commented 4 months ago

@AhmedLSayed9 @RCVZ @techouse

Hey folks,I will look into this but could you tell me about your environments? E.g. are you using the predefined build configurations on flutter or do you have something custom like VGV CLI?

AhmedLSayed9 commented 4 months ago

Hey folks,I will look into this but could you tell me about your environments? E.g. are you using the predefined build configurations on flutter or do you have something custom like VGV CLI?

I'm using the predefined build configurations as following:

flutterfire config \
--project=project-id \
--platforms=android,ios \
--out=lib/firebase_options_prod.dart \
--android-package-name=com.example.app \
--ios-bundle-id=com.example.app \
--android-out=/android/app/src/prod/ \
--ios-build-config=Debug-prod \
--ios-out=ios/config/prod/ \
--overwrite-firebase-options \
--yes
russellwheatley commented 4 months ago

I was able to reproduce, I have created a repo which demonstrates the problem here: https://github.com/russellwheatley/crashlytics-symbols

Going to elevate this issue as I don't see what is different to the way we handle the default app configuration. I'll let you know if I have any updates 🙏

tyypgzl commented 4 months ago

@russellwheatley i dont use multi environment. It happens debug mode and when i increase version and create new ipa. I dont understand if it is related to the error I mentioned.