Logging exceptions after publishing the application in Android - android

In my application during development to know the errors I am using system.out.println to log the errors but when I publish the application how would I log the errors and how would I know what are the issues while using the application.

Crash Report
You get the report inside Your developer console but Google only log
the exception to the server if the user clicks the "Report..."
button, AFAIK.
Get Crash and Exception Report
But if you want also get exception report as well as crash report,you may implement
(You may send exception/crash report to server programmatically)
Google Analytics for Android This link may help you to get start Google Analytics SDK v4 for Android

You can use Android UncaughtExceptionHandler. You can download the source code from
http://www.mediafire.com/download/pds2hlvnzceh2u8/AndroidMADQA_uncaughtException.zip

Related

Android 7+ send crash information

When a crash happened on Android 4 to 6, my apps gave the user the possibility to send the crash information as an e-email to me as developer.
When running my app on Android 7 Nougat via the normal route (handle UncaughtException) the user cannot get the possibility to send the crash information. How can I send the crash information as e-mail for my app running on Android 7?
You can use Firebase Crash Reporting
Crash Reporting creates detailed reports of the errors in your app. Errors are grouped into issues based on having similar stack traces, and triaged by the severity of impact on your users. In addition to automatic reports, you can log custom events to help capture the steps leading up to a crash.
Key capabilities
Monitor fatal and non-fatal errors
Collect the data you need to diagnose problems
Email alerts
Integrate with Analytics and Remote Config
Free and easy
See the answer of #Nilesh Rathod, #Sneha Sarkar (thank you!)
The successor of "Firebase Crash Reporting" is Crashalytics.
So, if you don't started using such a facility, advised is using Crashalytics.
I have installed it for all my apps. Per app you need 5 minutes if you follow the installation instructions ;-)
It is working fine.

how can I send log information from my Android app to my server?

I'm developing an Android app that is currently in the Play Store. I've been getting reports of a crash on certain devices that I can't reproduce, and the Play Store's built in crash diagnostics don't contain enough information. What I really need is the Logcat information from these devices, but it seems that Android 4.1 and above don't allow the use of those "Log Collector" apps that used to be so popular for this purpose due to security concerns. Is there a library that I can add to my app that will allow it to log to a remote server on demand? I know enough about this crash that I could put a call to some mythical sendLogcatNow() function in the appropriate spot in the code, if I had such a function. Since the information I seek is not actually part of the crash (the crash occurs later), normal crash reporting tools such as Crashlytics don't seem like they will do what I need, but perhaps they have this feature and it's just not prominent in the documentation. Thanks!
There are few version for crash reporting..
Hockey App
Acra
BugSense
Android Remote stack trace
Since your app can always read logs for it's own process, you can also implement something of your own.
Out of all these, I personally prefer Acra. as it is most efficient and give many options to app developers.
I'm using ACRA for logging crashes from my app but based on their documentation,
you can add your own variables content or debug traces to the reports
you can send error reports even if the application doesn't crash
Which seems to be doing what you want.
https://github.com/ACRA/acra
You will need to run your own ACRA server (simple enough to run) and get your app to send the crash logs to your server. Everything is detailed on their website.
I would look into using a third party production crash system, there are a few out there. I am currently using Crashlytics. This specific service allows you to log and set key value pairs during the running of the application that get packaged with the crash report. These services also offer greater insight into the device type, OS and a variety of other device details.
With this set up I have then created a log function that will submit to the Crashlytics service as well as logging it to log cat.
You can also use Google Analytics or Flurry. But note that Google Analytics doesn't log stack traces and Flurry doesn't support real-time log reports on server.

Get log of Application Crash & ANR?

I found a section Crash & ANR in my Google play account
This list the crashes occurred but this is when user report the crash.
I have well managed application but some times it is being crashed as reported by one user.
What i want to get a log from device for the application crashes and save and send automatically.
Is there any Process to get the details of all or Previous Crash from android systems on Next Application Start up?
You can trap and log it manually, but this is usually solved by integrating crash handling and reporting services like TestFlight, New Relic, and other similar services. There are some self-hosted, open source tools like android-remote-stacktrace too.
The libraries are set to capture any unhandled exception your application, log the exception to a remote server so you can view it without requiring the user to send it to you manually, and will then allow the original exception to be rethrown as normal.
Android Handling the Unexpected also covers the idea in detail with some sample code if you really want to do it yourself. That post also lists several more example external services.

How do you collect bug reports for a published android app

To collect crash reports as a developer one uses logcat. Is there a standard way for a published android application to capture crash logs so that your users can send them to you?
Is there any callback that is called when an app crashes for example? Can the strategy that logcat uses to log be adopted to a production game?
Similar question for iOS Apps:
How can I allow users to give me feedback and submit bug reports for my iOS app?
Related Question
How can I accept bug reports and other user feedback from within my app?
EDIT 1:
In addition to the frameworks mentioned in the answers below a lower level approach to capturing all uncaught exceptions can be used an is mentioned here Ideal way to set global uncaught exception Handler in Android
I personally use ACRA. I found it easy to integrate, and it meets my requirements.
Reports are sent to a spreadsheet in Google Docs, and it can be configured to send you an email every time the app crashes
Using logcat is a solution but is only feasible when crashes are coming from your own device. However, you can have the crashes occurring on your users’ devices automatically sent to you as well, including all crash and device details.
This could be done through Instabug which is a bug & crash reporting service.
It automatically sends a report containing all crash and device details once a crash occurs, plus It only takes a line of code to integrate in your app.
For full disclosure, I work at Instabug. Let me know if I can help.
You can include Flurry Analytics in your app, which does create an error log when something craches and sends in back to the server, which you have access to. It will give you all the information like the LogCat.
I hope this helps.
There is also FirebaseCrash by Google which reports logs on your Firebase console.
Read more about it here
The Google Play Developer Console also reports crashes and application not responsive, under crashes and ANRs for each app.

Android Exception Handling

We are converting out suite of iPhone apps written in .NEt MonoTouch to Android.
How do we catch, then publish exceptions so that they are reported via the Android Market?
You should also try Bugsense.com, it's free and allows you to track exceptions in Android.
PS: I am the founder
You need to use:
Thread.setDefaultUncaughtExceptionHandler(handler)
There you can catch everything and send mails, notifications, etc.
EDIT:
Check this questions, are basically the same:
Global uncaught exception handler -> email log to me?
is it possible to replace the default “Force Close” dialog in Android?
I highly recommend using the library android-remote-stacktrace. It uses the methods Macarse mentions but wraps it in a useful POST to your server, which you can use to put into a database or send an email.
You could also try Android-Error-Reporter which POSTs unhandled (or if necessary handled exceptions as well) to your server similar to android-remote-stacktrace but more reliable and it allows you to ask the user before sending the error report.
There's also Google's ACRA project (Application Crash Report for Android).
ACRA is a library enabling Android Application to automatically post their crash reports to a GoogleDoc form. It is targetted to android applications developers to help them get data from their applications when they crash or behave erroneously.
A few points about ACRA that are relevant to this question:
more detailed crash reports about the device running the app than what is displayed in the Android Market developer console error reports
you can add your own variables content or debug traces to the reports
you can send error reports even if the application doesn't crash
We recently started using ACRA in Andromo to receive crash reports, since the apps made with Andromo are uploaded to the market by the user who designed the app, and not by us. (Otherwise we'd rely on our users to forward any crash reports to us.)
That it also sends reports for apps that haven't been uploaded to the market is a nice bonus, because we could potentially catch problems while an app is still being tested, before the user uploads it to the market.

Categories

Resources