日々精進

新しく学んだことを書き留めていきます

UI Automator ViewerでViewの構造を調べる

Hierarchy ViewerでViewの構造を調べようとすると、以下のエラーメッセージが出て調べられなかった。

[2015-06-10 14:29:03 - ViewServerDevice]Unable to debug device: ...
[2015-06-10 14:29:04 - hierarchyviewer]Missing forwarded port for ...
[2015-06-10 14:29:04 - hierarchyviewer]Unable to get the focused window from device ...

原因はproduction向けビルドだったため。Hierarchy Viewerはproduction向けビルドの解析は出来ない。 そういう時はUI Automator Viewerを使うといい。 MACの場合は以下の場所にある。これを実行するとViewの構造がわかる。Hierarchy Viewerの方がわかりやすいので普段はそっちを使うべきだが、UI Automator Viewerにも使い道はあるんだね。

/Users/username/android-sdk-macosx/tools/uiautomatorviewer

参考: