Customize Error Message

Customize Error Message

Customize Error Message for Android

How to catch Uncaught Exception.

F958fbf402a67a1742335a4894e041e5?s=128

magiepooh

June 22, 2017
Tweet

Transcript

  1. Customize Error Message @magie_pooh shibuya.apk #16

  2. ࣗݾ঺հ ౻ాୖຏ @magie_pooh @magiepooh

  3. Customize Error Message @magie_pooh shibuya.apk #16

  4. Crash Reporting Tool • Crashlytics • Firebase Crash Reporting •

    Play Console
  5. Crash Reporting Tool • Crashlytics • Firebase Crash Reporting •

    Play Console
  6. None
  7. ͜͜ΛΧελϚΠζ͍ͨ͠

  8. None
  9. None
  10. None
  11. ফ͍ͨ͠

  12. private static Thread.UncaughtExceptionHandler defaultUEH;
 private static Thread.UncaughtExceptionHandler caughtExceptionHandler =
 new

    Thread.UncaughtExceptionHandler() {
 @TargetApi(Build.VERSION_CODES.KITKAT) @Override
 public void uncaughtException(Thread thread, Throwable throwable) {
 // do something defaultUEH.uncaughtException(thread, throwable);
 }
 }; @Override public void onCreate() {
 super.onCreate();
 Fabric.with(this, new Crashlytics());
 defaultUEH = Thread.getDefaultUncaughtExceptionHandler();
 Thread.setDefaultUncaughtExceptionHandler(caughtExceptionHandler);
 } ApplicationΫϥε
  13. private static Thread.UncaughtExceptionHandler defaultUEH;
 private static Thread.UncaughtExceptionHandler caughtExceptionHandler =
 new

    Thread.UncaughtExceptionHandler() {
 @TargetApi(Build.VERSION_CODES.KITKAT) @Override
 public void uncaughtException(Thread thread, Throwable throwable) {
 // do something defaultUEH.uncaughtException(thread, throwable);
 }
 }; @Override public void onCreate() {
 super.onCreate();
 Fabric.with(this, new Crashlytics());
 defaultUEH = Thread.getDefaultUncaughtExceptionHandler();
 Thread.setDefaultUncaughtExceptionHandler(caughtExceptionHandler);
 } ApplicationΫϥε
  14. private static Thread.UncaughtExceptionHandler defaultUEH;
 private static Thread.UncaughtExceptionHandler caughtExceptionHandler =
 new

    Thread.UncaughtExceptionHandler() {
 @TargetApi(Build.VERSION_CODES.KITKAT) @Override
 public void uncaughtException(Thread thread, Throwable throwable) {
 // do something defaultUEH.uncaughtException(thread, throwable);
 }
 }; @Override public void onCreate() {
 super.onCreate();
 Fabric.with(this, new Crashlytics());
 defaultUEH = Thread.getDefaultUncaughtExceptionHandler();
 Thread.setDefaultUncaughtExceptionHandler(caughtExceptionHandler);
 } ApplicationΫϥε
  15. private static Thread.UncaughtExceptionHandler defaultUEH;
 private static Thread.UncaughtExceptionHandler caughtExceptionHandler =
 new

    Thread.UncaughtExceptionHandler() {
 @TargetApi(Build.VERSION_CODES.KITKAT) @Override
 public void uncaughtException(Thread thread, Throwable throwable) {
 // do something defaultUEH.uncaughtException(thread, throwable);
 }
 }; @Override public void onCreate() {
 super.onCreate();
 Fabric.with(this, new Crashlytics());
 defaultUEH = Thread.getDefaultUncaughtExceptionHandler();
 Thread.setDefaultUncaughtExceptionHandler(caughtExceptionHandler);
 } ApplicationΫϥε
  16. private static Thread.UncaughtExceptionHandler defaultUEH;
 private static Thread.UncaughtExceptionHandler caughtExceptionHandler =
 new

    Thread.UncaughtExceptionHandler() {
 @TargetApi(Build.VERSION_CODES.KITKAT) @Override
 public void uncaughtException(Thread thread, Throwable throwable) {
 // do something defaultUEH.uncaughtException(thread, throwable);
 }
 }; @Override public void onCreate() {
 super.onCreate();
 Fabric.with(this, new Crashlytics());
 defaultUEH = Thread.getDefaultUncaughtExceptionHandler();
 Thread.setDefaultUncaughtExceptionHandler(caughtExceptionHandler);
 } ApplicationΫϥε
  17. private static Thread.UncaughtExceptionHandler defaultUEH;
 private static Thread.UncaughtExceptionHandler caughtExceptionHandler =
 new

    Thread.UncaughtExceptionHandler() {
 @TargetApi(Build.VERSION_CODES.KITKAT) @Override
 public void uncaughtException(Thread thread, Throwable throwable) {
 // do something defaultUEH.uncaughtException(thread, throwable);
 }
 }; @Override public void onCreate() {
 super.onCreate();
 Fabric.with(this, new Crashlytics());
 defaultUEH = Thread.getDefaultUncaughtExceptionHandler();
 Thread.setDefaultUncaughtExceptionHandler(caughtExceptionHandler);
 } ApplicationΫϥε
  18. Field field = Throwable.class .getDeclaredField("detailMessage");
 field.setAccessible(true);
 field.set(throwable, ""); ExceptionͷϝοηʔδΛͻͨ͢Βফ͢

  19. ফ͑ͨʂʂʂ

  20. Crashlyticsͷ࢓૊Έ • Fabric.with(this, new Crashlytics());

  21. Crashlyticsͷ࢓૊Έ • Fabric.with(this, new Crashlytics()); • CrashlyticsCore#onPreExecute()಺Ͱ CrashlyticsControllerΛੜ੒

  22. Crashlyticsͷ࢓૊Έ • Fabric.with(this, new Crashlytics()); • CrashlyticsCore#onPreExecute()಺Ͱ CrashlyticsControllerΛੜ੒ • CrashlyticsControllerΫϥεͰ

    CrashlyticsUncaughtExceptionHandlerΛੜ੒
  23. ·ͱΊ • UncaughtExceptionHandlerΛ࢖͑͹ΧελϚΠζͰ͖Δ • ଞͷCrash Reporting Tool͸ະௐࠪͳͷͰɺͲͳ͔ͨڭ͑ ͍ͯͩ͘͞ • Firebase

    Crash ReportingͰ͸ݸਓ৘ใʹؔΘΔ෦෼͸ ʮREDACTED_PERSONAL_IDENTIFICATION_NUMBER ʯʹͳΔΒ͍͠ɻ୭͔ڭ͍͑ͯͩ͘͞