18

I have :

  • Android SDK Tools, Revision 22

  • Android SDK Platform, API 18

I go to <android-sdk>/tools/ , I see there is one file named "uiautomatorviewer",

I execute command uiautomatorviewer from terminal under the above path, however I got the following message:

uiautomatorviewer: command not found

why?

Mellon
  • 37,586
  • 78
  • 186
  • 264

7 Answers7

60

Please note that uiautomatorviewer executable has been moved in SDK Tools Revision 25.3.0 update (Feb 2017) to new location under <android-sdk>\tools\bin

Leszek Jasek
  • 2,206
  • 1
  • 23
  • 30
15

Because your tools/ directory is not in your PATH. Either use ./uiautomatorviewer or add tools/ (and probably platform-tools/ to your PATH. Note that this has nothing to do with programming and everything to do with your *nix-style OS (Linux, OS X, etc.).

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks, I am using MacBook Pro – Mellon Sep 06 '13 at 13:20
  • This answer is outdated (although it was current when posted). Still, this same location is still used in google's official instructions here: https://developer.android.com/training/testing/ui-testing/uiautomator-testing . @CommonsWare do you know what is the procedure to alter this documentation? – Boris Strandjev Feb 28 '19 at 11:50
  • @BorisStrandjev: "do you know what is the procedure to alter this documentation?" -- [file an issue](https://issuetracker.google.com/issues), then pray that Google pays attention to it. – CommonsWare Feb 28 '19 at 12:05
  • Now the question is how do I open an issue about their issue creation form not working (component dropdown does not load anything in Chrome for Linux) :) At least my prayers are spared – Boris Strandjev Feb 28 '19 at 12:19
2

Navigate to tools folder, then launch terminal, launch monitor(Android Device Monitor) using ./monitor command.

ADM will get launched, left side of the window you may find uiautomatorviewer.

Kiran Sk
  • 873
  • 10
  • 24
2

Just follow these steps,

Open command prompt,Go to your bin folder inside tools folder of sdk location.

Example: C:\android-sdk\android-sdk\tools\bin.

Then in cmd type uiautomatorviewer and hit enter. It would immedialy open UI Automator Viewer.

C:\android-sdk\android-sdk\tools\bin>uiautomatorviewer

Refer screenshot

enter image description here

Community
  • 1
  • 1
R15
  • 13,982
  • 14
  • 97
  • 173
  • Thnx bro. You saved me a few hours of time – Sergei Buvaka Mar 15 '20 at 13:37
  • I Get the following error, and I don't understand what I am doing wrong (Bash on Ubuntu): -Djava.ext.dirs=/tools/lib/x86_64:/tools/lib is not supported. Use -classpath instead. Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. – MahNas92 Jan 08 '21 at 09:33
1

First, follow this tutorial to add ANDROID_HOME and Path variables.

Setup Android Environment Variables

Then, add this variable as variables in the tutorial.

Variable name: JAVA_HOME
Variable value: C:\Program Files (x86)\Java\jdk1.8.0_171

Now you can run uiautomatorviewer in C:\Users\%USERNAME%\AppData\Local\Android\Sdk\tools\bin.

Albert Khang
  • 621
  • 6
  • 17
1

For anyone trying to find it still on a fresh Android SDK download: this has been removed from the standard tools in API level 27. To install it, uncheck "Hide Obsolete Packages" and select "Android SDK Tools (Obsolete)" v 26.1.1..

enter image description here

and after this point, see other answers here.

See the Deprecation notice for more info, there's no explicit mention of uiautomatorviewer removal, but after 9 major releases (if you don't see 9+ yet, see here) of Command Line tools there's no sign of it in the cmdline-tools/latest folder.

TWiStErRob
  • 44,762
  • 26
  • 170
  • 254
0

It's path issue only so don't worry just put this path "%ANDROID_HOME%\tools\bin" in your system path. Now you can run uiautomatorviewer

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 26 '21 at 12:17