Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADDED] [#59] Leakcanary memory leak detection library from square. #60

Merged
merged 1 commit into from
Oct 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ This is my personal project to experiment with following tools & technologies
* Database (local caching - Realm (maybe?))
* Scheduler - data syncing
* Google Play Alpha Beta release
* LeakCanary
* LeakCanary _(See [#60](https://github.com/amardeshbd/android-daily-headlines/pull/60))_

I'll try to update references for these items when I use in the app :sunglasses:
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,5 @@ ext {
jodaTimeVersion = '2.9.4'
glassfishJavaxAnnotationVersion = '10.0-b28'
timberLibraryVersion = '4.3.1'
leakcanaryLibraryVersion = '1.5'
}
7 changes: 7 additions & 0 deletions core-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ dependencies {
compile "com.squareup.picasso:picasso:$rootProject.picassoVersion"


// leakcanary - A memory leak detection library for Android and Java.
// https://github.com/square/leakcanary
debugCompile "com.squareup.leakcanary:leakcanary-android:$rootProject.leakcanaryLibraryVersion"
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$rootProject.leakcanaryLibraryVersion"


// ----------------------------------------------------------------
// Android Unit and Instrumentation test
// ----------------------------------------------------------------
Expand All @@ -82,4 +88,5 @@ dependencies {
})
compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
testCompile "junit:junit:$rootProject.junitVersion"
testCompile "com.squareup.leakcanary:leakcanary-android-no-op:$rootProject.leakcanaryLibraryVersion"
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import android.app.Application;
import android.content.Context;

import com.squareup.leakcanary.LeakCanary;

import info.hossainkhan.android.core.dagger.components.AppComponent;
import info.hossainkhan.android.core.dagger.components.DaggerAppComponent;
import info.hossainkhan.android.core.dagger.modules.InteractorsModule;
Expand All @@ -46,10 +48,20 @@ public class CoreApplication extends Application {
public void onCreate() {
super.onCreate();

initLeakCanary();
initAppComponent();
initLogger();
}

private void initLeakCanary() {
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);
}

private void initLogger() {
if (ENABLE_LOGGING) {
android.util.Log.i(TAG, "Planting tree for timber logger.");
Expand Down