【问题标题】:Edittext is leaking using leakcanaryEdittext 正在使用leakcanary 泄漏
【发布时间】:2020-04-25 20:40:32
【问题描述】:

泄漏金丝雀日志 泄漏跟踪= ┬ ├─ java.lang.Thread │ 泄漏:未知 │ 线程名称:'Studio:InputCon' │ GC Root:Java局部变量 │ ↓ 线程 线程。 │ ~~~~~~~~~~~~ ├─ com.android.tools.profiler.support.event.InputConnectionWrapper │ 泄漏:未知 │ ↓ InputConnectionWrapper.mTarget │ ~~~~~~~ ├─ com.android.internal.widget.EditableInputConnection │ 泄漏:未知 │ ↓ EditableInputConnection.mTargetView │ ~~~~~~~~~~~ ├─ android.support.v7.widget.AppCompatEditText │ Leaking: YES (View.mContext 引用了一个被破坏的activity) │ mContext 的实例 │ View#mParent 已设置 │ View#mAttachInfo 为空(视图分离) │ View.mWindowAttachCount = 1 │ ↓ AppCompatEditText.mContext ╰

【问题讨论】:

    标签: android android-studio kotlin memory-leaks leakcanary


    【解决方案1】:

    如果你能提供代码 sn-p 那就更好了。

    1. 编辑文本不应是静态的。喜欢(静态Edittext edtText;)
    2. 在活动的 onDestroy () 中使编辑文本引用为空。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多