Skip to content

Commit 6775f20

Browse files
committed
Update LeakCanary library
1 parent 1925687 commit 6775f20

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ ext {
119119
groupieVersion = '2.10.1'
120120
markwonVersion = '4.6.2'
121121

122-
leakCanaryVersion = '2.9.1'
122+
leakCanaryVersion = '2.11'
123123
stethoVersion = '1.6.0'
124124
mockitoVersion = '4.0.0'
125125
assertJVersion = '3.23.1'
@@ -291,7 +291,7 @@ dependencies {
291291
// Memory leak detection
292292
implementation "com.squareup.leakcanary:leakcanary-object-watcher-android:${leakCanaryVersion}"
293293
implementation "com.squareup.leakcanary:plumber-android:${leakCanaryVersion}"
294-
debugImplementation "com.squareup.leakcanary:leakcanary-android:${leakCanaryVersion}"
294+
debugImplementation "com.squareup.leakcanary:leakcanary-android-core:${leakCanaryVersion}"
295295
// Debug bridge for Android
296296
debugImplementation "com.facebook.stetho:stetho:${stethoVersion}"
297297
debugImplementation "com.facebook.stetho:stetho-okhttp3:${stethoVersion}"

app/src/debug/java/org/schabi/newpipe/DebugApp.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class DebugApp : App() {
1414
initStetho()
1515

1616
// Give each object 10 seconds to be GC'ed, before LeakCanary gets nosy on it
17-
AppWatcher.config = AppWatcher.config.copy(watchDurationMillis = 10000)
17+
AppWatcher.manualInstall(this, retainedDelayMillis = 10000)
1818
LeakCanary.config = LeakCanary.config.copy(
1919
dumpHeap = PreferenceManager
2020
.getDefaultSharedPreferences(this).getBoolean(

app/src/main/java/org/schabi/newpipe/BaseFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ protected void onRestoreInstanceState(@NonNull final Bundle savedInstanceState)
8181
public void onDestroy() {
8282
super.onDestroy();
8383

84-
AppWatcher.INSTANCE.getObjectWatcher().watch(this);
84+
AppWatcher.INSTANCE.getObjectWatcher().expectWeaklyReachable(
85+
this, "Watch for leaks from destroyed fragments.");
8586
}
8687

8788
/*//////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)