Skip to content

Commit 430e479

Browse files
committed
added leakcanary to sample
1 parent f3a2447 commit 430e479

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

app/build.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ dependencies {
4444
compile "com.android.support:appcompat-v7:$project.supportLibVersion"
4545
compile "com.jakewharton.timber:timber:$project.timberVersion"
4646

47+
debugCompile "com.squareup.leakcanary:leakcanary-android:$project.leakCanaryVersion"
48+
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$project.leakCanaryVersion"
49+
testCompile "com.squareup.leakcanary:leakcanary-android-no-op:$project.leakCanaryVersion"
50+
4751
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2', {
4852
exclude group: 'com.android.support', module: 'support-annotations'
4953
}

app/src/main/java/de/jonasrottmann/realmsample/Application.java

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package de.jonasrottmann.realmsample;
22

3+
import com.squareup.leakcanary.LeakCanary;
4+
35
import de.jonasrottmann.realmbrowser.RealmBrowser;
46
import io.realm.Realm;
57
import io.realm.RealmConfiguration;
@@ -12,6 +14,12 @@ public class Application extends android.app.Application {
1214
@Override
1315
public void onCreate() {
1416
super.onCreate();
17+
18+
if (LeakCanary.isInAnalyzerProcess(this)) {
19+
return;
20+
}
21+
LeakCanary.install(this);
22+
1523
Timber.plant(new Timber.DebugTree());
1624

1725
Realm.init(this);

build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ buildscript {
1717
// dependencies
1818
timberVersion = '4.5.1'
1919
supportLibVersion = '25.3.1'
20+
leakCanaryVersion = '1.5.1'
2021
}
2122

2223
repositories {

0 commit comments

Comments
 (0)