5

I am building an android library that I plan to integrate into many 3rd party apps(which do not belong to me).

So, I am trying to figure out a way to find out if any of those 3rd party apps crashes due to the code in my library. Is there any way to find that out?

I was looking at Crashlytics to achieve the same. But, as I understand, Crashlytics will be able to give the Crash analytics to only the app owner, right? Is there any way to collect the crash info without the intervention of the 3rd party app?

Thanks.

EDIT: This isn't a duplicate of Integrating Crashlytics to library project because I want Crashlytics to be part of an android library which will sit on multiple android apps, but I want to be notified separately - not from the app which is installing my android library.

Community
  • 1
  • 1
Sid
  • 1,270
  • 2
  • 15
  • 30
  • Possible duplicate of [Integrating Crashlytics to library project](http://stackoverflow.com/questions/28828679/integrating-crashlytics-to-library-project) – PsyGik Jul 09 '16 at 16:20
  • No it isn't a duplicate. I want crashlytics to work across the apps which have my library installed. – Sid Jul 11 '16 at 07:56
  • Which basically means you need to install Crashlytics in your library project – PsyGik Jul 11 '16 at 10:25

2 Answers2

6

Mike from Fabric here. Adding Fabric or Crashlytics into a library that will be used by external developers is not supported and should not be done.

Mike Bonnell
  • 16,181
  • 3
  • 61
  • 77
  • 1
    Thanks, I have a couple of questions then: 1. How do I achieve what I want to? Any pointers on this will help(even if it includes Crashlytics or not). 2. Why is there this section in your doc then: https://docs.fabric.io/android/crashlytics/build-tools.html#set-up-a-library-subproject Does this signify something else? – Sid Jul 11 '16 at 14:17
  • 1) I'm not sure of a way to use a crash handler from a library without impacting the other app. You would also want to disclose this to any developer using your library as some of their information could be exposed to you as well. 2) That doc is for internal libraries, for example, where a library is being used within a company and there is no risk of leaking data. There would also be no conflict in the keys being used. – Mike Bonnell Jul 11 '16 at 14:21
  • But if we need to explicitly invoke Crashlytics for a sub-library, does that mean that Crashlytics will not be enabled for all libraries used by the app, by default? – Sid Jul 11 '16 at 14:40
  • Not necessarily, as we recommend the app still be the deciding factor for if to initialize Fabric or not. – Mike Bonnell Jul 11 '16 at 15:53
  • hey, it seems that Crashlytics captures crashes only when app is connected to Android Studio. Why so? – Hammad Nasir Feb 18 '17 at 02:37
  • 1
    Hey @HammadNasir We definitely work outside of the app being connected to Android Studio ; if you're having issues seeing crashes I'd recommend making a new question as this questions is related to Libraries specifically. – Mike Bonnell Feb 21 '17 at 17:22
  • @MikeBonnell done.. please check it out: http://stackoverflow.com/q/42375212/6144372 – Hammad Nasir Feb 21 '17 at 18:31
  • @MikeBonnell is this still not supported? – Hades Jun 24 '17 at 00:14
  • Correct, not supported at the moment. – Mike Bonnell Jun 26 '17 at 14:05
  • @MikeBonnell is there any update on this issue? I'm looking for a way to integrate 3rd party library to capture crashes inside library. Any help would be appreciated – gokhan Oct 08 '19 at 14:03
  • I'm no longer working on the product so I'm not sure. – Mike Bonnell Oct 09 '19 at 15:36
0

No, you cannot, at least without some hacking. Crashlytics should only be user in applications or library subproject (https://docs.fabric.io/android/crashlytics/build-tools.html#set-up-a-library-subproject). And you shouldn't, crashlytics group all the crashes by package name. Even if you with some hacking were able to include the crashlytics in your library you will probably receive also crashes from the application (not related with your library), and you will need to include and expose your API keys in your library... So you should not include crashlytics in a library.

Sandro Machado
  • 9,921
  • 4
  • 36
  • 57
  • Okay, so what should I use to determine crashes in my library code? – Sid Jul 11 '16 at 11:41
  • Try to make tests in your library to increase the code coverage. If everything is covered by tests you should not have crashes :). If your library is in github and is public encourage the community to open issues and contribute. – Sandro Machado Jul 11 '16 at 12:31