Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I remove leak canary code/classes for release build?

I searched for an answer to this and couldn't find anything, which probably means it's a basic question. At the risk of showing my ignorance, I'm going to ask anyway. I am preparing my app for release and want to insure Leak Canary doesn't popup for my users. My leak canary related dependencies are as such.

dependencies {
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
}

I think that since the releaseCompile contains no-op it means I can proceed with my release build as is without removing the Leak Canary code. Am I right?

like image 274
seekingStillness Avatar asked Apr 09 '17 18:04

seekingStillness


2 Answers

I found this online.

dependencies {
// Real LeakCanary for debug builds only: notifications, analysis, etc
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'

// No-Op version of LeakCanary for release builds: no notifications, no analysis, nothing
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
}
like image 144
seekingStillness Avatar answered Oct 19 '22 10:10

seekingStillness


The answers are correct but there's an updated and easier solution as of 4/13/19:

    dependencies {
      debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-3'
    }

no need for no-ops nor proguard.

but why?

ok but how?

like image 30
sudocoder Avatar answered Oct 19 '22 10:10

sudocoder