I am unable to get an analysis after installing Leak Canary in my app.
I get these two lines in my Log Cat:
"Scheduling check for retained objects because found new object retained"
"Ignoring check for retained objects scheduled because found new object retained: LeakCanary.Config.dumpHeap is false"
So no dump is performed and no analysis carried out.
Using debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2' in Gradle
Gradle 3.5.0
compileSdkVersion 28
targetSdkVersion 28
I am testing on a real device running Android 9
JUnit is not on the build path as this was noted to be a problem in previous releases of Canary Leak.
Hi @jordantrain ! Sorry for the delayed response. This seems to be the source of the issue:
LeakCanary.Config.dumpHeap is false
Do you have any code referencing LeakCanary, or did you simply add the dependency?
Any chance you could come up with a repro case in a sample app?
If you filter the logs, you should find a log early on app start that indicates that dumpHeap was set to false and hopefully you can figure out why.
I am facing the same issue.
I only added the debug dependency in Gradle file. I am getting the following log:
LeakCanary heap dumping is disabled: LeakCanary.config.dumpHeap = false
@guneetkaur can you filter Logcat on the LeakCanary tag and then paste here all of the logs from the beginning of app start?
@guneetkaur can you filter Logcat on the
LeakCanarytag and then paste here all of the logs from the beginning of app start?
Here are the logs
D/LeakCanary: org.junit.Test detected in classpath, app is running tests => disabling heap dumping & analysis
D/LeakCanary: Updated LeakCanary.config: Config(dumpHeap=false)
D/LeakCanary: LeakCanary heap dumping is disabled: LeakCanary.config.dumpHeap = false
D/LeakCanary: Watching instance of androidx.fragment.app.FragmentManagerViewModel (androidx.fragment.app.FragmentManagerViewModel received ViewModel#onCleared() callback) with key 54399d8a-722d-493d-bf12-790e8de07cc1
D/LeakCanary: Watching instance of leakcanary.internal.ViewModelClearedWatcher (leakcanary.internal.ViewModelClearedWatcher received ViewModel#onCleared() callback) with key c39cd230-2f51-476f-834c-18b3bedcefbd
D/LeakCanary: Watching instance of androidx.lifecycle.ReportFragment (androidx.lifecycle.ReportFragment received Fragment#onDestroy() callback) with key 80ad8341-7cc4-4c66-bd6b-2495de026e18
D/LeakCanary: Watching instance of com.myairtelapp.activity.SplashScreenActivity (com.myairtelapp.activity.SplashScreenActivity received Activity#onDestroy() callback) with key 4658245c-a320-4f4f-a0f9-8b6b2c21cc1c
D/LeakCanary: Scheduling check for retained objects because found new object retained
D/LeakCanary: Ignoring request to check for retained objects (found new object retained), already scheduled in 0ms
D/LeakCanary: Ignoring check for retained objects scheduled because found new object retained: LeakCanary.Config.dumpHeap is false
D/LeakCanary: Scheduling check for retained objects because found new object retained
D/LeakCanary: Ignoring check for retained objects scheduled because found new object retained: LeakCanary.Config.dumpHeap is false
See that first line:
D/LeakCanary: org.junit.Test detected in classpath, app is running tests => disabling heap dumping & analysis
Normal Android applications don't have @Test in their classpath unless they're running test. However, sometimes 3rd party library bring it in as a dependency (e.g. retrofit mock webserver). One way to work around that is that have change the test detection to a different class that is really only used in tests:
<resources>
<string name="leak_canary_test_class_name">assertk.Assert</string>
</resources>
Closing as this doesn't look like a LeakCanary bug.
Just check your build.gradle (app) and change "implementation" to "testImplementation" or "androidTestImplementation" for junit/test:runner/espresso and etc.
Most helpful comment
See that first line:
Normal Android applications don't have
@Testin their classpath unless they're running test. However, sometimes 3rd party library bring it in as a dependency (e.g. retrofit mock webserver). One way to work around that is that have change the test detection to a different class that is really only used in tests: