| | |
| | | @Override |
| | | public void uncaughtException(Thread thread, Throwable ex) { |
| | | try { |
| | | long current = System.currentTimeMillis(); |
| | | String time2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(current)); |
| | | try { |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | PrintStream print = new PrintStream(out); |
| | | //导出发生异常的时间 |
| | | print.println(time2); |
| | | //导出手机信息 |
| | | dumpPhoneInfo(print); |
| | | print.println(); |
| | | ex.printStackTrace(print); |
| | | SpUtil.saveString(FILE_NAME+time2,new String(out.toByteArray())); |
| | | |
| | | print.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | System.out.println("错误日志2"+e.getMessage()); |
| | | //LogUtils.e(TAG, "dump crash info failed"); |
| | | } |
| | | |
| | | //导出异常信息到SD卡中 |
| | | McSystemUi mcSystemUi = McSystemUi.getInstance(mContext); |
| | | MCUtils.show(mcSystemUi); |
| | |
| | | // 如果用户没有处理则让系统默认的异常处理器来处理 |
| | | mDefaultHandler.uncaughtException(thread, ex); |
| | | } |
| | | long current = System.currentTimeMillis(); |
| | | String time2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(current)); |
| | | try { |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | PrintStream print = new PrintStream(out); |
| | | //导出发生异常的时间 |
| | | print.println(time2); |
| | | //导出手机信息 |
| | | dumpPhoneInfo(print); |
| | | print.println(); |
| | | ex.printStackTrace(print); |
| | | SpUtil.saveString(FILE_NAME+time2,new String(out.toByteArray())); |
| | | |
| | | print.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | System.out.println("错误日志2"+e.getMessage()); |
| | | //LogUtils.e(TAG, "dump crash info failed"); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |