How to start uiautomatorviewer in cmd?

hii,
when i try to open uiautomatorviewer in command prompt, its showing the below error!
even though i have installed jdk in my system.anroid|690x265

@vk you have 2 options:

  1. create shortcut on desktop to “uiautomatorviewer.bat” which is in “…/Android/sdk/tools/bin/uiautomatorviewer” (path for mac. for windows similar something like: c:\users<username>\AppData\Local\Android\sdk\tools)
  2. add path to this folder into PATH variable and start uiautomatorviewer in console. (example - http://www.automationtestinghub.com/setup-android-environment-variables/ )
1 Like

@Aleksei
hi, thank you
I tried both the options,but none of them worked

@vk you “tried it wrong” :slight_smile: both should work. otherwise you did something wrong. for example was you able to find “uiautomatorviewer.bat” in android tools folder?

@Aleksei
yes,uiatomatorviewer is available in C:\Users\vk\AppData\Local\Android\sdk\tools\bin,then i created a shortcut in desktop and even added the path in environment variables…

@vk but when you click on this bat nothing started? did you installed JDK ? http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html - choose windows x64.

@Aleksei
yes jdk is installed, when i click on that bat file its showing error stating windows cannot find make sure u typed the name correctly.As, iam following this link for appium installation"http://www.automationtestinghub.com/setup-android-environment-variables/"

@vk well you need investigate more yourself… what problem is with your system

@Aleksei
ok sure, Thank you for your quick response
…

@vk one moment. when you did change in system. restart your console prompt. just close and start again to grab changes you made.

@Aleksei
ok sure, thankyou

This worked for me… thanks :slight_smile:

Unable to start uiautomatorviewer on Ubuntu machine. Need a solution and even it says android command is depreciated

First go to Android SDK folder and find the uiautomatorviewer in tools/bin directory.

If you do not find tools folder you have to install it usind sdkmanager command because android command is depricated

follow this to install

https://developer.android.com/studio/command-line/sdkmanager

Hi, I followed the steps to install appium from this link : “http://www.automationtestinghub.com/setup-android-environment-variables/”

but when i try to start ui automator viewer, it gives me access denied error.

any ideas ?

@kabhishek check your user permissions for this file

Try to tape adb shell
then reopen the uiautomatorviewer.bat

Hi Alksei,

I’m facing the below error when I trying to open the uiautomatorviewer on cmd.
using JDK 12.0.1

-Djava.ext.dirs=…\lib\x86_64;…\lib is not supported. Use -classpath instead.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit

1 Like

The problem is that you are using Java 12.
-Djava.ext.dirs is an option that specifies a directory, this directory should contains the files that hold the classes you import.
For example you import com.someclass, you should enter the directory of someclass.jar.

The problem is that -Djava.ext.dirs is a deprecated option, you should download java8 and try again.
This post shares a similar problem: https://bytefreaks.net/tag/java-ext-dirs