dag roger stokland rui
dag roger stokland rui

Reputation: 173

Android phone not dumping stack trace

I have a problem with my phone not printing uncaught exceptions in logcat.

To show the problem i have this piece of code:

ArrayList list = null;
list.add("something");

The only thing logcat shows is:

W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x4160ac80)

The weird thing is that i have another phone which prints the correct null pointer exception. Furthermore, printing messages with Log.e(TAG,"error") works perfectly. Anyone know why this might happen?

Upvotes: 1

Views: 53

Answers (2)

dag roger stokland rui
dag roger stokland rui

Reputation: 173

This worked if anyone has the same problem:

Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread thread, Throwable ex) {
                ex.printStackTrace();
            }
        });

Upvotes: 0

F43nd1r
F43nd1r

Reputation: 7749

Uncaught exceptions are handled by Thread.defaultUncaughtHandler. Depending on the platform and manufacturer this might differ.

Upvotes: 1

Related Questions