mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-09 15:27:55 -04:00
Add Leakcanary to the project (#655)
This commit is contained in:
parent
c7abb86eae
commit
ebac71aeed
@ -116,6 +116,11 @@ dependencies {
|
||||
// Mockito
|
||||
testImplementation "org.mockito:mockito-core:2.7.22"
|
||||
androidTestImplementation "org.mockito:mockito-android:2.7.22"
|
||||
|
||||
// Leak canary
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
|
||||
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
|
||||
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
|
||||
}
|
||||
|
||||
// Set custom app import directory
|
||||
|
@ -21,6 +21,8 @@ import android.content.Context;
|
||||
import android.support.multidex.MultiDexApplication;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
|
||||
import com.squareup.leakcanary.LeakCanary;
|
||||
|
||||
import org.kiwix.kiwixmobile.di.components.ApplicationComponent;
|
||||
import org.kiwix.kiwixmobile.di.components.DaggerApplicationComponent;
|
||||
import org.kiwix.kiwixmobile.di.modules.ApplicationModule;
|
||||
@ -39,6 +41,17 @@ public class KiwixApplication extends MultiDexApplication {
|
||||
return application;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
LeakCanary.install(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
|
Loading…
x
Reference in New Issue
Block a user