Android: FragmentManagerの警告

Androidアプリの開発中にこういうメッセージがたくさん出ていたので気になって調べた。

W/FragmentManager: moveToState: Fragment state for HogeFragment{77b975f #2 id=0x7f0e0079} not updated inline; expected state 3 found 2

結果としてては出ていても気にしなくていいらしい。
余計なログが出ることについてはbuildToolsをバージョンアップすると解決する。

開発者からの解答 (Mar 7, 2016)

Nope, it doesn’t matter and the extra log will be gone in a future release.

For the curious, FragmentManager.moveToState now updates the new fragment state as it goes rather than at the end after all of the state change phases have completed. This fixed several interesting bugs around using the child fragment manager and executePendingTransactions from within one of the parent fragment’s lifecycle callbacks.

One of the state transitions as we’re bringing a fragment up is a no-op that wasn’t getting the state updated inline, and the log you’re seeing is announcing that we did it at the end instead, exactly as we would have prior to 23.2.

Sorry for the extra log noise 🙂

このように余計な警告ログが出るのは23.2より前のバージョンのbuildToolsで見られるもので、
24.0.0が公開された時点でこの問題は解決積みとなっている。

自分の環境でもbuildToolsをアップデートしたら警告は出なくなった。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です