#StackBounty: #android #leakcanary How can I exclude a class from LeakCanary?

Bounty: 50

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


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.