mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-23 12:42:56 -04:00
#1258 upgrade leakcanary to 2.0 and enable crashing on instrumentation runs
This commit is contained in:
parent
882d94a6f2
commit
b986ff9192
@ -124,9 +124,9 @@ dependencies {
|
|||||||
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
|
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
|
||||||
|
|
||||||
// Leak canary
|
// Leak canary
|
||||||
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
|
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-2'
|
||||||
androidTestImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
|
androidTestImplementation "com.squareup.leakcanary:leakcanary-android-instrumentation:2.0-alpha-2"
|
||||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
|
|
||||||
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
|
||||||
implementation "android.arch.lifecycle:extensions:1.1.1"
|
implementation "android.arch.lifecycle:extensions:1.1.1"
|
||||||
@ -212,6 +212,7 @@ android {
|
|||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
testInstrumentationRunnerArgument "listener", "leakcanary.FailTestOnLeakRunListener"
|
||||||
// See https://github.com/linkedin/dexmaker/issues/65 for why we need the following line.
|
// See https://github.com/linkedin/dexmaker/issues/65 for why we need the following line.
|
||||||
testInstrumentationRunnerArguments.notClass = "com.android.dex.DexIndexOverflowException"
|
testInstrumentationRunnerArguments.notClass = "com.android.dex.DexIndexOverflowException"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
@ -26,7 +26,6 @@ import android.util.Log;
|
|||||||
import androidx.appcompat.app.AppCompatDelegate;
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.multidex.MultiDexApplication;
|
import androidx.multidex.MultiDexApplication;
|
||||||
import com.jakewharton.threetenabp.AndroidThreeTen;
|
import com.jakewharton.threetenabp.AndroidThreeTen;
|
||||||
import com.squareup.leakcanary.LeakCanary;
|
|
||||||
import dagger.android.AndroidInjector;
|
import dagger.android.AndroidInjector;
|
||||||
import dagger.android.DispatchingAndroidInjector;
|
import dagger.android.DispatchingAndroidInjector;
|
||||||
import dagger.android.HasActivityInjector;
|
import dagger.android.HasActivityInjector;
|
||||||
@ -73,11 +72,6 @@ public class KiwixApplication extends MultiDexApplication implements HasActivity
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.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);
|
AndroidThreeTen.init(this);
|
||||||
if (isExternalStorageWritable()) {
|
if (isExternalStorageWritable()) {
|
||||||
File appDirectory = new File(Environment.getExternalStorageDirectory() + "/Kiwix");
|
File appDirectory = new File(Environment.getExternalStorageDirectory() + "/Kiwix");
|
||||||
@ -110,7 +104,6 @@ public class KiwixApplication extends MultiDexApplication implements HasActivity
|
|||||||
|
|
||||||
Log.d("KIWIX", "Started KiwixApplication");
|
Log.d("KIWIX", "Started KiwixApplication");
|
||||||
applicationComponent.inject(this);
|
applicationComponent.inject(this);
|
||||||
LeakCanary.install(this);
|
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
StrictMode.setThreadPolicy(buildThreadPolicy(new StrictMode.ThreadPolicy.Builder()));
|
StrictMode.setThreadPolicy(buildThreadPolicy(new StrictMode.ThreadPolicy.Builder()));
|
||||||
StrictMode.setVmPolicy(buildVmPolicy(new StrictMode.VmPolicy.Builder()));
|
StrictMode.setVmPolicy(buildVmPolicy(new StrictMode.VmPolicy.Builder()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user