Init ACRA when starting commons application (#2091)

* Init ACRA when starting commons application
* Remove redundant ACRA initialization function
This commit is contained in:
albendz 2018-12-14 06:34:37 -08:00 committed by Adam Jones
parent aa4ab37adb
commit 1d951f5f8a

View file

@ -91,6 +91,7 @@ public class CommonsApplication extends Application {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
ACRA.init(this);
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
//FIXME: Traceur should be disabled for release builds until error fixed //FIXME: Traceur should be disabled for release builds until error fixed
//See https://github.com/commons-app/apps-android-commons/issues/1877 //See https://github.com/commons-app/apps-android-commons/issues/1877
@ -118,7 +119,6 @@ public class CommonsApplication extends Application {
// Empty temp directory in case some temp files are created and never removed. // Empty temp directory in case some temp files are created and never removed.
ContributionUtils.emptyTemporaryDirectory(); ContributionUtils.emptyTemporaryDirectory();
initAcra();
if (BuildConfig.DEBUG && !isRoboUnitTest()) { if (BuildConfig.DEBUG && !isRoboUnitTest()) {
Stetho.initializeWithDefaults(this); Stetho.initializeWithDefaults(this);
} }
@ -152,16 +152,6 @@ public class CommonsApplication extends Application {
Timber.plant(new Timber.DebugTree()); Timber.plant(new Timber.DebugTree());
} }
/**
* Remove ACRA's UncaughtExceptionHandler
* We do this because ACRA's handler spawns a new process possibly screwing up with a few things
*/
private void initAcra() {
Thread.UncaughtExceptionHandler exceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
ACRA.init(this);
Thread.setDefaultUncaughtExceptionHandler(exceptionHandler);
}
public static boolean isRoboUnitTest() { public static boolean isRoboUnitTest() {
return "robolectric".equals(Build.FINGERPRINT); return "robolectric".equals(Build.FINGERPRINT);
} }