I did that and already fixed the bug ;-).

Thanks for your help on this one.

Cheers
Emanuel

On Nov 17, 8:48 pm, Zsolt Vasvari <zvasv...@gmail.com> wrote:
> No idea.  Every time I try to set up ProGuard options, my head starts
> to hurt.
>
> For the next update of your app, why don't you just inline
> prepareCongratulationsDialog() yourself and then you should at least
> see the real line number.
>
> On Nov 17, 9:45 pm, Emanuel Moecklin <1gravity...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Thanks Zsolt, you are right.
>
> > I built a test version that throws an NPE in
> > prepareCongratulationsDialog() and the stack trace still showed 860
> > not the line of code throwing the NPE.
>
> > I just don't understand why setting all these attributes like
> > -keepattributes
> > InnerClasses,EnclosingMethod,SourceFile,LineNumberTable
> > -printmapping mapping.txt
> > and using retrace to get an unobfuscated stack trace wouldn't give me
> > the correct line number?
>
> > Cheers
> > Emanuel
>
> > On Nov 16, 10:42 pm, Zsolt Vasvari <zvasv...@gmail.com> wrote:
>
> > > If prepareCongratulationsDialog() is only called once, it will be
> > > merged by ProGuard, so the NPE will be in
> > > prepareCongratulationsDialog() itself somewhere. The line number is
> > > useless.
>
> > > On Nov 17, 11:39 am, Emanuel Moecklin <1gravity...@gmail.com> wrote:
>
> > > > I get reports of NullPointerExceptions in onPrepareDialog in line 860
> > > > (method call to prepareCongratulationsDialog(dialog)):
> > > >         @Override
> > > >         protected void onPrepareDialog(int id, Dialog dialog) {
> > > >                 super.onPrepareDialog(id, dialog);
> > > >                 switch (id) {
> > > >                 case DIALOG_CONGRATULATIONS:
> > > >                         prepareCongratulationsDialog(dialog); // line 
> > > > 860
> > > >                         break;
> > > >                 case DIALOG_...:
> > > >                         // some code
> > > >                 }
> > > >         }
>
> > > >         private void prepareCongratulationsDialog(Dialog dialog) {
> > > >                 // some code
> > > >         };
>
> > > > The dialog is a managed dialog opened using
> > > > showDialog(DIALOG_CONGRATULATIONS)
>
> > > > The stack trace looks like this:
> > > > java.lang.NullPointerException
> > > >         at 
> > > > com.company.app.MyActivity.onPrepareDialog(MyActivity.java:860)
> > > >         at android.app.Activity.onPrepareDialog(Activity.java:2505)
> > > >         at android.app.Activity.showDialog(Activity.java:2555)
> > > >         at android.app.Activity.showDialog(Activity.java:2514)
> > > >         ...
>
> > > > I normally can't reproduce the problem (only once so far) and it seems
> > > > to happen on arbitrary devices and Android versions but once it occurs
> > > > it seems to have a certain persistency (I normally get several crash
> > > > reports from the same devices).
> > > > How could that line possibly cause an NPE? Even if dialog were null
> > > > (which it isn't, I had a productive version that tested against dialog
> > > > being null and that didn't help), at least
> > > > prepareCongratulationsDialog should be called.
> > > > In that case the stack trace would show the line of code in
> > > > prepareCongratulationsDialog causing the NPE (tested that as well just
> > > > to make sure).
> > > > I tried to put a try catch around the method call. What happened is
> > > > that the app didn't crash and the dialog appeared but "unprepared"
> > > > meaning with all the %1$s etc. placeholders that the onPrepareDialog
> > > > is supposed to replace.
>
> > > > If the method prepareCongratulationsDialog itself isn't crashing how
> > > > could line 860 possibly cause an NPE?
> > > > Could the fact that I'm using ProGuard be related to these crashes?
>
> > > > Any help is very much appreciated.
>
> > > > Emanuel Moecklin
> > > > 1gravity LLC- 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to