Note that I made a blog entry to explain how I made a crash reporter
using email on my blog, there :
http://androidblogger.blogspot.com/2009/12/how-to-improve-your-application-crash.html

It's a very effective way to catch the bugs, and to find how they
happen.

The fact that it is send by mail ( so the user should accept to send
it ) makes it really easy to do, you don't need to have a web site to
handle them, but most of the users won't send it. In my view, if
nobody sent me an crash report, I take it for granted there is no
common bug. If a bug is really common and happens often, it will be
sent !

Hope it helps,

Emmanuel

Ps : By the way, I don't fully understand why Flurry doesn't provide
the full call stack. They are so close, and they have done most of the
work to have a super useful tool, and they just stop one inch before
it... Strange... ( but it makes me feel good to have develop my own
crash reporter )

On Feb 3, 5:40 pm, Streets Of Boston <[email protected]> wrote:
> This is not necessary, to catch every line of code.
>
> Register an uncaught-exception-handler
> (Thread.setDefaultUncaughtExceptionHandler). Before you set it, get
> the current one. You may need to call it from your own uncaught-
> exception-handler.
>
> In this handler, print out the stack-trace (and some other info such
> as OS-version, phone model, make, etc) to a file (on phone-memory or
> sd-card)
>
> These above steps are the bare basics.
>
> In my app, I added a Service and an Activity, both running in a
> different process than my app whose stack-traces i'm logging. If they
> would run in the same process, it woudn't work (calling a Service and
> Activity from a dying process).
>
> The uncaught-exception-handling code binds to the Service
> (initialization) and upon a stack-trace dump, after having generated
> the file, it does a Service-request:
>
> The Service starts the Activity that just shows a dialog asking the
> using to submit an error report or not. If the user answers 'Yes',
> then the Activity will read the file with the stack-trace info and
> send it to a web-server (Http). The web-server gets this request,
> generates an e-mail from it that is then sent to my inbox.
>
> When the uncaught-exception-handler calls the service, it just kills
> and extis the process. If the handler could not bind to the Service or
> the Service-request failed, it calls the original default uncaught-
> exception-handler that then shows the common 'Force Close' dialog.
>
> This has been working well for me and found a few bugs here and
> there :)
>
> On Feb 3, 5:24 am, Martin <[email protected]> wrote:
>
>
>
> > Or is there another possibility to debug my game, while it is in the
> > market?
> > How can I intercept all the errors in my code to find out how I can
> > solve them?
>
> > If nobody has an answer to this, I have to put a
> > try {
> > ...} catch (Exception e) { /* send this exception and line number over
>
> > internet to me */ }
> > on EVERY line of code?
>
> > For example:
>
> >         @Override
> >         public void onCreate(Bundle savedInstanceState) {
>
> > try {
> >                 DisplayMetrics dm = new DisplayMetrics();
> >                 getWindowManager().getDefaultDisplay().getMetrics(dm);
> >                 Global.screen_width = dm.widthPixels;
> >                 Global.screen_height = dm.heightPixels;
> >                 Global.screen_width_factor = 320/Global.screen_width;
> >                 Global.screen_height_factor = 480/Global.screen_height;} 
> > catch (Exception e) { /* send exception - METRICS */ }
>
> > try {
>
> >                 super.onCreate(savedInstanceState);
> >                 requestWindowFeature(Window.FEATURE_NO_TITLE);
> >                 this.getWindow().setFlags
> > (WindowManager.LayoutParams.FLAG_FULLSCREEN,
> >                                 WindowManager.LayoutParams.FLAG_FULLSCREEN 
> > );} catch (Exception e) { /* send exception - window */ }
>
> > try {
>
> >                 setContentView(R.layout.main);} catch (Exception e) { /* 
> > send exception - contentview */ }
>
> > try {
>
> >                 //Sound starten
> >                 SharedPreferences prefs = getSharedPreferences("options", 
> > 0);
> >                 Global.bgmusic=prefs.getBoolean("music", true);
> >                 Global.soundeffects=prefs.getBoolean("soundeffects", 
> > true);} catch (Exception e) { /* send exception - start sound */ }
>
> > try {
>
> >                 b_start = (Button) findViewById(R.id.b_start);
> >                 b_start.layout(120*Global.screen_width_factor,
> > 55*Global.screen_height_factor,
> >                                 
> > (120+buttonwidth)*Global.screen_width_factor, (55+buttonheight)*
>
> > } catch (Exception e) { /* send exception - startbuttoncreated */ }
>
> > and so on....
>
> > or is there a better solution?
>
> > Greetings, Martin
>
> > On 3 Feb., 10:11, Martin <[email protected]> wrote:
>
> > > Hi!
>
> > > I have a game in the market and with flurry analytics, I receive all
> > > my errors. Here are some of them:
>
> > >  01/31/10 01:47:39 PM PST        0       class
> > > java.lang.IllegalArgumentException       parameter must be a descendant of
> > > this view
> > >  02/02/10 12:40:41 PM PST        0       class
> > > java.lang.IllegalThreadStateException    Thread already started.
> > >  01/26/10 09:25:36 PM PST        0       class 
> > > java.lang.NullPointerException
> > >                  1.0 (beta)      uncaught                Android
> > >  02/01/10 05:26:27 PM PST        0       class java.lang.OutOfMemoryError
> > > bitmap size exceeds VM budget    1.3 (beta)      uncaught                
> > > Android
> > >  01/29/10 10:23:10 AM PST        0       class java.lang.RuntimeException
> > > Adding window failed     1.0 (beta)      uncaught                Android
> > >  01/29/10 08:19:05 AM PST        0       class java.lang.RuntimeException
> > > Unable to start activity ComponentInfo{digle.de.LeonardFrog/
> > > digle.de.LeonardFrog.AHighscore}: java.lang.NullPointerException         
> > > 1.0
> > > (beta)   uncaught                Android
> > >  01/27/10 01:09:35 AM PST        0       class java.lang.VerifyError
> > > digle.de.LeonardFrog.AHighscore          1.0 (beta)      uncaught         
> > >        Android
>
> > > I want to solve them but I need a logcat. There is the application
> > > "aLogcat" in the Market, which displays the logcat on the mobile, but
> > > I need the logcat of my users without telling them to download this
> > > app, because many people are lazy and won't do it. How can I get this
> > > logcat? Is there maybe a library, which sends me the logcat on error?
>
> > > Greetings, Martin- Hide quoted text -
>
> > - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to