From 33838e6a14cdd71490214c9f4822b80238c71fda Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 27 Jun 2017 07:34:04 -0700 Subject: [PATCH] don't crash when crashlytics didn't get built in correctly --- .../org/eehouse/android/xw4/CrashTrack.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/xwords4/android/app/src/xw4d/java/org/eehouse/android/xw4/CrashTrack.java b/xwords4/android/app/src/xw4d/java/org/eehouse/android/xw4/CrashTrack.java index f5c1c0c7e..da4998243 100644 --- a/xwords4/android/app/src/xw4d/java/org/eehouse/android/xw4/CrashTrack.java +++ b/xwords4/android/app/src/xw4d/java/org/eehouse/android/xw4/CrashTrack.java @@ -31,27 +31,30 @@ public class CrashTrack { private static final String TAG = CrashTrack.class.getSimpleName(); public static void init( Context context ) { - if ( 0 < BuildConfig.FABRIC_API_KEY.length() ) { // Crashlytics/Fabric sample code wants this between onCreate()'s // super() call and the call to setContentView(). We'll see if // this works. - Fabric.with( context, new Crashlytics() ); + try { + Fabric.with( context, new Crashlytics() ); - // Now crash as a test - if ( false ) { - new Thread( new Runnable() { - @Override - public void run() { - try { - Thread.sleep(5000); - } catch (InterruptedException ex) {} - String nullStr = null; - if ( nullStr.equals("") ) { - Log.d( TAG, "something's very wrong" ); + // Now crash as a test + if ( false ) { + new Thread( new Runnable() { + @Override + public void run() { + try { + Thread.sleep(5000); + } catch (InterruptedException ex) {} + String nullStr = null; + if ( nullStr.equals("") ) { + Log.d( TAG, "something's very wrong" ); + } } - } - } ).start(); + } ).start(); + } + } catch ( Exception ex ) { + Log.d( TAG, "problem initing crashlytics" ); } } }