We are converting out suite of iPhone apps written in .NEt MonoTouch to Android.
How do 开发者_如何学Gowe 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.
精彩评论