在我的 Application 类中,我尝试使用以下代码忽略 AOSP 的所有泄漏:
LeakCanary.install(this, null, AndroidExcludedRefs.createAppDefaults().build());
但这并不能阻止报告下面提到的InputMethodManager
泄漏。我做错了或不支持这样的操作
D/LeakCanary: In myapp:0.1.25-SNAPSHOT:12500.
D/LeakCanary: * EXCLUDED LEAK.
D/LeakCanary: * myapp.ui.activities.HomeActivity has leaked:
D/LeakCanary: * GC ROOT static android.view.inputmethod.InputMethodManager.sInstance
D/LeakCanary: * references android.view.inputmethod.InputMethodManager.mCurRootView , matching exclusion field android.view.inputmethod.InputMethodManager#mCurRootView
D/LeakCanary: * references com.android.internal.policy.impl.PhoneWindow$DecorView.mContext
D/LeakCanary: * leaks myapp.ui.activities.HomeActivity instance
D/LeakCanary: * Retaining: 3.8KB.