Log to Logcat before a SIGSEGV /SEGV_MAPERR crash - android

I have a native library that has a native crash. The crash doesn't happen consistently and I can't reproduce it. I have access to Google breakpad's minidump and last few thousands LogCat lines from the users. The method doesn't crash all the time so I suspect perhaps it crashes because of specific param values that I haven't checked. Unfortunately this is a method that's called a lot so I can't log to LogCat all the time.
I understand that try/catch doesn't work for SIGSEGV. But is there a similar mechanism?
Something like this https://stackoverflow.com/a/2436368/4092412.

Related

Can it possible to get log before print the logcat?

Can it possible to get the logs before it print into terminal? Or I want to know how the crash crashlytics takes logs.
Crashlytics doesn't have anything to do with the log system. It hooks the top level exception handler, so that exceptions that are not handled by the program normally are handled by the library.

crashlytics keeps registering exception after code removed

This problem sounds really weird and it looks is somehow my mistake but isn't
I use crashlytics to keep logs and track exception of the usage of my app
for that i created a lib in the log4j interface which simple calls the crashlytics methods for log events.
On the first version of my lib i add an extra Crashlytics.logException() to every logger.error() in my code. After using it for a while i noticed that this behavior wasn't what i want and I removed the Crashlytics.logException()
BUT CRASHLYTICS KEPT SHOWING EXCEPTIONS ON THAT
I'm really confuse with that and for a long time i thought i was doing something wrong, but after debuging the code thousands of times i came to think that there is something beyond what i see
there is no metion of Crashlytics.logException() in my code, and somehow i still manage to see many errors in my crashlytics dashboard
can someone help me with that?
what events might generate a non-fatal issue on crashlytics dashboard
attach:
- https://pastebin.com/Rbu1ySpd this is the core class of my log lib
- whenever i want to log an even i do `logger.log("something");' in a very log4j way

Detect app crash in android

I'm building an app that sometimes crashes, I want to know that it crashed in the next time I opened it so I can suggest to the user some post-crash options.
How can I detect the crash?
Also I want to be able to save the user's work before it crashes, I means real time detection of crash, can I do it without knowing where it crashed?
You will need to know where it crashed in order to set the try/catch blocks in the right place to, er, catch the crash and save the data or whatever you have in mind.
This is known as "graceful" termination if you want to consider it in more detail.
Unfortunately neither Java destructor/finalize methods nor lifecycle methods such as onDestroy are anywhere near as robust as try/catch blocks so I'm afraid that is your only option, and how many of us deal with exception prevention. No-one would wittingly provide a user experience that crashes, much less with loss of their data.
Take a took at the ACRA library. You can configure it so whenever a crash happens you can control it and even send the crash log by email
You can use try/catch blocks, then send details on the Exception in your catch.
There are implement UncaughtExceptionHandler as mentioned in these answers and write crash report in some file or use it another way.
ACRA is already mentioned.
However for paid version, I found BugSnag is very good at this.
Or if you want to take the extra mile, try AppSee.
AppSee even has video recording session of how the crash happens. It is from tapping that button on the second list, the menu button or even when the user slides left in your viewpager.

How can I send crash reports from Android using Google Analytics API v2

I am having troubles (and a lot of frustration) trying to set up a working GoogleAnalytics environment on my Android native app. Mainly it seems to me that the documentation is rather incomplete, which is not a problem as long as it's working. But it's not, in my case.
I have created a profile on GoogleAnalytics. I can see it's working fine in two manners:
In the logs, I can see which URL the app is using to report basic activity usage
On the GoogleAnalytics dashboard / Real-time / Overview I can see that my use of the app is reported.
However, I can't see any crash coming up whatever the alternative listed on GoogleAnalytics' documentation I'm using.
Are crash reports also supposed to come with a 24h delay?
Setting
<bool name="ga_reportUncaughtExceptions">true</bool>
, when a crash happens (explicitely throwing a new RuntimeException("TestGoogleAnalytics")), i can see in the logs:
I/GAV2 (31358): Thread[main,5,main]: Tracking Exception: TestGoogleAnalytics
W/GAV2 (31358): Thread[main,5,main]: dispatch call queued. Need to call GAServiceManager.getInstance().initialize().
I/GAV2 (31358): Thread[main,5,main]: Passing exception to original handler.
And I'm wondering if the warning hints anything about something I've missed to initialize.
I haven't been able to find much information about this
GAServiceManager.getInstance().initialize()
Any help appreciated :)
Okay, I finally got my reports the day after. Somehow "GAV2" is printing out a lot of errors and warnings that don't seem to affect statistics and crash reports.

Can multiple data reporting utilities report on the same uncaught exception?

My app uses Flurry for analytics and the excellent ACRA for uncaught exception reporting. This means that there are 3 places uncaught exception reporting happens: Flurry, ACRA and the crash error report within the Android Developer Console. As far as I can tell, it looks like only one of the 3 areas catches and reports on an exception. And, more strangely, it seems random as to which one it is. I.e. sometimes an exception is reported in ACRA, sometimes in Flurry and sometimes in the Developer Console. I don't have a high enough volume of exceptions (thankfully!) to see any patterns, but ideally I'd like all exceptions at a minimum to go to ACRA. Am I missing something as to how this works? Is it possible for all exceptions to go to all 3 reporting places?
You can disable Flurry's exception handling using this command in your onStart() -
FlurryAgent.setCaptureUncaughtExceptions(false);
This way it won't interfere with other handlers.
Update June 2013
This answer still stands as the way to achieve this goal, but from my experience, Flurry seem to catch an exception here and there in spite of this flag. So it's not a 100% reliable solution. Recently I moved to Google Analytics, and turned off the exception handling - and it is perfectly reliable in that respect.

Categories

Resources