when my app crashes it throws some lines in Logcat:
07-10 10:35:34.671 32391-32391/com.noframe.farmisagronom D/AndroidRuntime﹕ Shutting down VM
07-10 10:35:34.671 32391-32391/com.noframe.farmisagronom W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x415bf8b0)
How to force app to print stack trace of exception?
my application class code:
public class Application extends MultiDexApplication {
@Override
protected void attachBaseContext(Context base) {
try {
super.attachBaseContext(base);
MultiDex.install(this);
}catch (Exception e)
{
e.printStackTrace();
}
}
@Override
public void onCreate() {
try {
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
Log.e("Uncaught Exception detected in thread {}", t.getName(), e);
}
});
} catch (SecurityException e) {
Log.e("Could not set the Default Uncaught Exception Handler", "" ,e);
}
super.onCreate();
}
}
Note that setDefaultUncaughtExceptionHandler
is my try to get stack trace form exception, but it dose not work.
When i go wild with try-catch every where, i catch those exceptions. But that's not always an option, and requires a huge amount of time.