Leakcanary: Support for watching destroyed Fragments (extension?)

Created on 24 Apr 2018  路  2Comments  路  Source: square/leakcanary

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

researching enhancement

Most helpful comment

I got this.

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

divyenduz picture divyenduz  路  6Comments

peter1492 picture peter1492  路  6Comments

hidroh picture hidroh  路  3Comments

smallgirl picture smallgirl  路  3Comments

SUPERCILEX picture SUPERCILEX  路  4Comments