回答編集履歴
1
引用文の追加
answer
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
レポートによれば、Viewのメモリリークが起きているようです。Viewよりも生存期間の長いオブジェクト(例えば、FragmentやAAC ViewModelなど)から、直接的あるいは間接的にViewへの参照を保持していないかチェックしてみてください。
|
2
2
|
|
3
3
|
間接的にViewの参照を保持してしまっているよくありがちなパターンとしては、DataBindingのインスタンスをFragmentのメンバ変数として保持する実装があります。これについては公式ドキュメントでもonDestryoViewにてきちんと解放してくださいと但し書きがあります。
|
4
|
-
[https://developer.android.com/topic/libraries/view-binding#fragments](https://developer.android.com/topic/libraries/view-binding#fragments)
|
4
|
+
[https://developer.android.com/topic/libraries/view-binding#fragments](https://developer.android.com/topic/libraries/view-binding#fragments)
|
5
|
+
|
6
|
+
> Note: Fragments outlive their views. Make sure you clean up any references to the binding class instance in the fragment's onDestroyView() method.
|