#1258 upgrade leakcanary to 2.0 and enable crashing on instrumentation runs

This commit is contained in:
Sean Mac Gillicuddy 2019-07-10 14:57:16 +01:00
parent 882d94a6f2
commit b986ff9192
2 changed files with 4 additions and 10 deletions

View File

@ -124,9 +124,9 @@ dependencies {
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
// Leak canary
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
androidTestImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-2'
androidTestImplementation "com.squareup.leakcanary:leakcanary-android-instrumentation:2.0-alpha-2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "android.arch.lifecycle:extensions:1.1.1"
@ -212,6 +212,7 @@ android {
minSdkVersion 15
targetSdkVersion 28
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArgument "listener", "leakcanary.FailTestOnLeakRunListener"
// See https://github.com/linkedin/dexmaker/issues/65 for why we need the following line.
testInstrumentationRunnerArguments.notClass = "com.android.dex.DexIndexOverflowException"
multiDexEnabled true

View File

@ -26,7 +26,6 @@ import android.util.Log;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.multidex.MultiDexApplication;
import com.jakewharton.threetenabp.AndroidThreeTen;
import com.squareup.leakcanary.LeakCanary;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.HasActivityInjector;
@ -73,11 +72,6 @@ public class KiwixApplication extends MultiDexApplication implements HasActivity
@Override
public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return;
}
AndroidThreeTen.init(this);
if (isExternalStorageWritable()) {
File appDirectory = new File(Environment.getExternalStorageDirectory() + "/Kiwix");
@ -110,7 +104,6 @@ public class KiwixApplication extends MultiDexApplication implements HasActivity
Log.d("KIWIX", "Started KiwixApplication");
applicationComponent.inject(this);
LeakCanary.install(this);
if (BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(buildThreadPolicy(new StrictMode.ThreadPolicy.Builder()));
StrictMode.setVmPolicy(buildVmPolicy(new StrictMode.VmPolicy.Builder()));