Created
December 1, 2017 04:48
-
-
Save sreelallalu/4e4f401dcbcd161dddc84b90ad7ccadf to your computer and use it in GitHub Desktop.
Memory leak using LeakCanary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependency | |
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4' | |
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4' | |
Application | |
public class LeakCanaryApplication extends Application { | |
public static RefWatcher getRefWatcher(Context context) { | |
LeakCanaryApplication application = (LeakCanaryApplication) context.getApplicationContext(); | |
return application.refWatcher; | |
} | |
private RefWatcher refWatcher; | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
refWatcher = LeakCanary.install(this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment