LeakCanary is a memory leak detection library for Android and Java. LeakCanary
My project is based on android make file system, which relies on some android internal interfaces and custom methods.
How can I add the LeakCanary as a lib into my app to detect memory leak.
My solution: First, I have to build the LeakCanary as a jar file, but how to. as it's a gradle directory structure, and I have never used Gradle before.
Any tip is precious.
For Leak Canary, you should work with Android Studio. In Android Studio, In your build.gradle, add this
dependencies {
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
}
And in your Application class, add this line LeakCanary.install(this); in onCreate() method like this
public class ExampleApplication extends Application {
@Override public void onCreate() {
super.onCreate();
LeakCanary.install(this);
}
}
follow this link https://github.com/square/leakcanary for more details.
Hope this might be helpful.