Tuesday, 12 February 2019

How can I exclude a class from LeakCanary?

I'm doing this:

ExcludedRefs excludedRefs = AndroidExcludedRefs.createAppDefaults()
                .clazz("androidx.lifecycle.ReportFragment")
                .reason("Very annoying report fragment leak that isn't a leak apparently")
                .alwaysExclude()
                .build();
        LeakCanary
                .refWatcher(context)
                .listenerServiceClass(DisplayLeakService.class)
                .excludedRefs(excludedRefs)
                .watchDelay(10, TimeUnit.SECONDS)
                .buildAndInstall();

And yet I'm still getting the ReportFragment was never GCed but no leak found.

I also get that for one of my activities, no I idea what to do about these no leak found messages.

Edit: current using LeakCanary 1.6.3



from How can I exclude a class from LeakCanary?

No comments:

Post a Comment