firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.7k stars 3.97k forks source link

[firebase_crashlytics] File names are incorrect on Android (still an issue?) #6925

Closed carman247 closed 1 year ago

carman247 commented 3 years ago

Pretty sure this is still an issue ...

https://github.com/FirebaseExtended/flutterfire/issues/80

If not, which version was it fixed in, or what needs to be done differently to prevent recording errors in .java files?

I'm using: firebase_crashlytics: ^2.0.6

markusaksli-nc commented 3 years ago

Hi @carman247 Could you please try upgrading to the latest firebase_crashlytics: ^2.2.1? Thank you

carman247 commented 3 years ago

Hi @carman247 Could you please try upgrading to the latest firebase_crashlytics: ^2.2.1? Thank you

Ok, will upgrade and report back

carman247 commented 3 years ago

I've tested using 2.2.1 in release mode and still getting errors reported as java files instead of dart.

markusaksli-nc commented 3 years ago

Seeing this as well. Since https://github.com/FirebaseExtended/flutterfire/issues/80 is locked this can be tracked here as a continuation.

russellwheatley commented 3 years ago

@carman247, are you able to provide steps to reproduce this behaviour? Perhaps in the firebase_crashlytics/example project. I'm seeing dart file extensions in my crash reports.

Screenshot 2021-09-14 at 16 10 16
google-oss-bot commented 3 years ago

Hey @carman247. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

yuzurihaaa commented 3 years ago

The project I am working on is using

  firebase_core: ^1.6.0
  firebase_crashlytics: ^2.2.1

and one example I copy from crashlytics is (with some code change due to pnc)

Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Null check operator used on a null value. Error thrown Instance of 'ErrorDescription'.
       at State.context(State.java:1095)
       at _EntryPage.initState.<fn>(initState.java:33)
       at Utils.afterBuild.<fn>(afterBuild.java:94)
       at SchedulerBinding._invokeFrameCallback(SchedulerBinding.java:1144)
       at SchedulerBinding.handleDrawFrame(SchedulerBinding.java:1090)
       at SchedulerBinding._handleDrawFrame(SchedulerBinding.java:998)

I realised I faced this issue after I recreate android project (gradle version upgraded here), enable multidex, and change every reference from fabric to firebase in build.gradle and android/build.gradle.

carman247 commented 3 years ago

I have also updated my project from fabric to firebase .. I'll try and get some more information added today about how I am implementing crashlytics/firebase.

Could updating from fabric to crashlytics, and some lingering references be what's causing the problem?

bounty1342 commented 3 years ago

Hi @russellwheatley,

Following your recommendation I tested the firebase_crashlytics/example.

Works on debug mode : image

but NOT on release : image

Debut mode show correct class and ligne number : image

Release mode show correct line number but no class and replace 'dart' with 'java' (Other crash may differ more) image

flutter doctor -v
[✓] Flutter (Channel stable, 2.5.2, on macOS 11.6 20G165 darwin-x64, locale en-GB)
    • Flutter version 2.5.2 at /Users/bounty1342/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3595343e20 (30 hours ago), 2021-09-30 12:58:18 -0700
    • Engine revision 6ac856380f
    • Dart version 2.14.3
  firebase_crashlytics: ^2.2.2
  firebase_core: ^1.7.0

This is certainly why there is also issues with obfuscation. This is a really annoying issue.

bounty1342 commented 3 years ago

flutter build appbundle --release --obfuscate --split-debug-info=build/app/outputs/symbols produce obfuscated code that Firebase can't handle: image

Previous issue similar to this : https://github.com/FirebaseExtended/flutterfire/pull/4407

Btw on @untp screenshot it also show java classes instead of dart:
https://github.com/FirebaseExtended/flutterfire/pull/4407#issuecomment-815945809

https://github.com/FirebaseExtended/flutterfire/pull/4407#issuecomment-815605757This PR explain why the .java behavior but it should be made clear on the docs as a warning. (People expect dart file and I was confuse to see those java...)

Finally, the PR regex dosent seem to match with this : . #00 abs 0 virt 00000000001cb0af _kDartIsolateSnapshotInstructions+0xe660f (.java)

Hopefully i'm wrong, but it seems the previous PR was incomplete. Hope this help.

Regards

untp commented 3 years ago

I reproduced the issue above where it worked in debug but not in release.

I used this simple code (and copied firebase_crashlytics/lib/src/utils.dart to project directory for testing getStackTraceElements):

import 'dart:async';
import 'dart:convert';

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/material.dart';

import 'utils.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  FirebaseCrashlytics.instance.recordError('Error object', StackTrace.current);
  print(jsonEncode(getStackTraceElements(StackTrace.current)));
}

Debug mode:

Release mode:

Obfuscated release mode: Deobfuscation: #0 main (package:crashlytics_example/main.dart:13:71)

print(jsonEncode(getStackTraceElements(StackTrace.current))) output: Debug mode: [{"file":"package:crashlytics_example/main.dart","line":"14","method":"main"}] Release mode: [{"file":"package:crashlytics_example/main.dart","line":"14","method":"main"}]

Json encoded getStackTraceElements returns same output both in debug and release. So the problem is not caused from this package. It is probably in the backend.

Deobfuscation can be done with https://github.com/FirebaseExtended/flutterfire/issues/2644#issuecomment-746217634. I also filed an issue to dart sdk (dart-lang/sdk#47357), so we can directly deobfuscate without editing any lines.

bounty1342 commented 2 years ago

It hard to keep deobfuscing by hand for apps in production. Is there any configuration that will prevent this issues or alternative setup ?

On top of it, every version produce a new set of error, and have to switch better symbols... This make Crashlytics unfit for production app atm...

russellwheatley commented 2 years ago

Hey @untp, great work investigating. I don't suppose you raised an issue with Firebase Support for everybody to track? 😄

untp commented 2 years ago

I didn't contact Firebase Support about this issue. I just shared my findings.

russellwheatley commented 2 years ago

I've raised an issue with Firebase support, will update this channel once I have feedback.

4ntoine commented 2 years ago

Any update on this? it seems to be related to https://stackoverflow.com/questions/71164040/how-to-get-readable-stacktrace-for-dart-code-exception-with-firebase-crashlytics

russellwheatley commented 2 years ago

@4ntoine - I'm still in communication. Will update when I have something to report.

russellwheatley commented 2 years ago

Quick update - Firebase support was able to reproduce and will look to get this fixed. No ETA as such, I was told to keep an eye out for future releases/release notes 👌

russellwheatley commented 2 years ago

Hey folks, I haven't noticed anything in the release notes, but I believe this issue has now been resolved. Could someone please confirm that the correct file extension is now displayed in the Crashlytics console, please 🙏 ?

google-oss-bot commented 2 years ago

Hey @carman247. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 2 years ago

Since there haven't been any recent updates here, I am going to close this issue.

@carman247 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

4ntoine commented 2 years ago

Still having the issue

google-oss-bot commented 2 years ago

Since there haven't been any recent updates here, I am going to close this issue.

@carman247 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

bounty1342 commented 2 years ago

This one should stay open.

@russellwheatley, can you check with Firebase support what's the exact status for this issue on their side ?

Thanks

russellwheatley commented 2 years ago

@bounty1342 reopened. Firebase support said to keep an eye on release notes for changes in status. No changes so far I'm afraid.

Lyokone commented 1 year ago

Since version 2.9.0 this should not be an issue anymore:

FEAT: Send Flutter Build Id to Crashlytics to get --split-debug-info working

Please reopen if needed.