larpon / QtFirebase

An effort to bring Google's Firebase C++ API to Qt + QML
MIT License
284 stars 83 forks source link

State of Crashlytics support #96

Closed MasterMind2k closed 5 years ago

MasterMind2k commented 5 years ago

Hi.

I haven't seen any reference to Crashlytics in this repo and I am opening up this issue just to ask a few questions :).

I want to add Crashlytics support to my Qt Android app, which I was able to do (by using Firebase SDK directly) for Java part. If I want to use NDK crashlytic, my app starts to crash more often (shutdown of the app crashes).

And now the question :). Does QtFirebase have any additions to make Crashlytics usage better or is the same as using vanilla approach? I'll be switching to QtFirebase soon, just asking if my issue will also be resolved with the switch :).

And another question. If you do not use Crashlytics for crash reports, do you use any other service?

Thank you.

larpon commented 5 years ago

Hi @MasterMind2k - thanks for considering QtFirebase!

I'm sorry to inform you that we currently does not have Crashlytics wrapped. (Pull Requests are welcome!) - we don't have any crash reporting tools other than what comes with Qt.

The project grows as users need more functionality from the Firebase C++ SDK - so we didn't wrap everything from the start.

adolby commented 5 years ago

The official Firebase Crashlytics documentation doesn't currently address setting up NDK support, but you can find some information on Fabric's site. It seems that you'll need to add some configuration to your build.gradle file:

apply plugin: 'com.android.library'
apply plugin: 'io.fabric'

android {
  compileSdkVersion <CURRENT COMPILESDKVERSION>
  buildToolsVersion "<YOUR BUILD TOOLS VERSION>"

  defaultConfig {
    applicationId "<YOUR APP'S PACKAGE NAME>"
  }
}

crashlytics {
  enableNdk true
  // If using the Android plugin for Gradle version 2.2.0+ with the externalNativeBuild DSL,
  // you should remove the androidNdkOut and androidNdkLibsOut properties, as these paths will
  // automatically be detected by the Fabric plugin.
  androidNdkOut 'obj'
  androidNdkLibsOut 'libs'
  manifestPath 'AndroidManifest.xml'
}

In my testing adding this configuration doesn't seem to work on its own.

If you try the instructions in this StackOverflow question, you may be able to enable the NDK support, but I haven't tried this yet myself.

MasterMind2k commented 5 years ago

After updating gradle config, you need to write a Fabric.with(this, new Crashlytics(), new CrashlyticsNDK()); into Create method of your main activity. Which works, but crashes every time after Qt app closes with a double free exception.

Also, I've figured out to enable debug symbols, you need to enable Qt's separate debug info and use those files as androidNdkOut (if I'm not mistaken).

I'm also wondering how you guys track crashes on Android/iOS platform :).

larpon commented 5 years ago

Thanks for your input good people.

I'm basically debugging all my applications with an insane amount of console.log and qDebug calls - that's it. That way I can always pinpoint where in my execution path things get fishy 🎏 and start investigating from there.

I've grown up learning to program without fancy debuggers, libs and smart mechanisms - so I always spend a little extra time on writing debug prints everywhere. It hasn't failed me yet

MasterMind2k commented 5 years ago

Thanks for the input. Sounds like a viable alternative :).

Unfortunately, I was getting crashes from deep within WebView (that does not show up anymore, curiously).

I'll see if Crashlytics (Fabric) tech support is going to get any breakthroughs in this area.

larpon commented 5 years ago

Don't know if this is any good https://github.com/dschmidt/libcrashreporter-qt

MasterMind2k commented 5 years ago

This is for Breakpad.

MasterMind2k commented 5 years ago

I got feedback from Fabric. They don't give support for Qt :), but they are aware of this issue.

I've also tested Bugsnag. It does not crash at exit, but it also doesn't work :).

So I started to think, that perhaps, I could implement a signal handler and try to call Crashlytics API via JNI and get C++ stack trace through that. I got some code running (called in same thread, POC of course) but have the following issues:

I've also searched for alternatives and stumbled upon this: https://docs.sentry.io/platforms/minidump/breakpad/ - uploading minidumps directly to Sentry

I've asked Fabric if they have any other options to send reports to their server. If they don't, I would just close this issue.

larpon commented 5 years ago

Keep us updated - I'm sure others can benefit from your quest :slightly_smiling_face:

MasterMind2k commented 5 years ago

Crashlytics works only with their libraries. There is no way to be able to send custom backtraces to Crashlytics. Which means it is unusable with Qt, for the moment.

larpon commented 5 years ago

Thanks for sharing!