Follow up from #894
We don't want to add the support library as a dependency on LeakCanary.
We could have a separate module, say leakcanary-fragments as an optional dependency, that depends on the support library and automatically watches fragment.
Not sure what options we have, one of them could be to add a provider to get called on app startup, from there add an activity lifecycle listener and from there start listening to fragments.
In the meantime, or instead, another option is to update the FAQ section that mentions BaseFragment and add @kurtisnelson 's code from #894
I started exploring the idea of bringing back's @kurtisnelson's code but with a Java proxy and reflection to avoid any strong dependency. But it turns out, unlike Activity lifecycle callbacks, FragmentLifecycleCallbacks is an abstract class, so we can't implement it with a Java Proxy. Oh well, just another inconsistent Android API, who would have thought.
I got this.
Most helpful comment
I got this.