By Jochen D.
Read this first if you are setting up today. UIAutomatorViewer ships inside the legacy Android SDK Tools package, which Google has deprecated. Its release notes state: "This SDK Tools package is deprecated and no longer receiving updates. Instead, use the new Android SDK Command-Line tools package." The last documented revision of that package is 26.1.1, from September 2017, so on a current SDK install you may not have the tool at all.
If you are writing Appium tests, use Appium Inspector instead (latest release 2026.7.1). It inspects the same view hierarchy, works against iOS as well as Android, and can attach to a remote session, including one running on TestingBot. For local Android debugging rather than Appium work, Android Studio's Layout Inspector is the direct replacement. The locator advice further down this page still applies whichever inspector you use. Checked 31 August 2026.
UIAutomatorViewer is an app testing tool, developed by Google, which comes with the Android SDK to inspect application screens from an Android device (or emulator). It offers a UI to inspect various elements on an Android screen. Simply use your mouse to navigate through the various screen components and find the selectors which you can use in your automated tests.
Using UIAutomatorView in combination with Appium is a good idea, because it allows you to find the most optimal selectors to automate any Android app.
Setting up UIAutomatorViewer
UIAutomatorViewer was distributed with the Android SDK Tools package, as uiautomatorviewer (or uiautomatorviewer.bat on Windows) under the SDK's tools/bin directory. That package is deprecated and its replacement, the Android SDK Command-Line Tools, is a different set of executables, so a fresh SDK install is not guaranteed to give you this tool.
If you still have it, launching it and clicking the screenshot button gives you a live view of whatever is on the connected device, with a hierarchy panel on the right. If you do not, Appium Inspector is the direct replacement for Appium work and needs no Android SDK component at all.
Once the program is started, you can click the screenshot button to indicate that you want to see a live view of the app currently running on the device. Once the live view appears, a sidepanel on the right will show a hierarchy view of the components that make up the current screen.
What should I use instead of UIAutomatorViewer?
Two tools cover what UIAutomatorViewer did, and which one you want depends on whether you are debugging locally or writing Appium tests.
Android Studio's Layout Inspector
This is the Android-native replacement, and it is a current, maintained part of Android Studio. Google describes it as letting you "inspect and debug the layout inside a running app in an emulator or physical device", where "you can inspect the attributes of each component". That is the same job UIAutomatorViewer did, with a live view rather than a captured snapshot.
To open it, run your app, go to the Running Devices window and click Toggle Layout Inspector. The Component Tree gives you the view hierarchy and the Attributes panel gives you the properties of whatever you select, which is where you will find the content-desc, resource-id, text and class values the locators below are built from.
A few practical notes. It runs embedded in the Running Devices window by default, and you can un-embed it from Settings > Tools > Layout Inspector if you prefer a separate window. Turn on Deep Inspect to click components in the layout instead of interacting with the app normally. Inspecting a physical device rather than an emulator requires device mirroring to be enabled. It also handles Jetpack Compose, including recomposition counts, which UIAutomatorViewer never did.
Appium Inspector
If you are writing Appium tests, use Appium Inspector instead. It shows the same hierarchy and attributes, but it does so through an Appium session, so the locators it hands you are the ones your test will actually use, and it works against iOS as well as Android. It can also attach to a remote session, including one running on TestingBot, which Layout Inspector cannot do.
Note that it is distributed as a desktop application from its GitHub releases page, currently 2026.7.1. The appium-inspector package on npm has not been updated since 2023 and is not the thing to install.
How do I locate elements using UIAutomatorViewer?
The right side panel of UIAutomatorViewer will contain a hierarchical view of the current application's layout structure. As you click some of the items in the panel, you will see the properties for each of these items.
Properties such as content-desc, class, resource-id and text can be helpful to construct locators which you can use in your automated Appium tests.
For example, you have a layout with a button that you want to click. You use UIAutomatorViewer to inspect the button and see that it has these properties:
content-desc: myButtontext: my-buttonresource-id: com.testingbot.test:id/mybuttonclass: android.widget.Button
We can now construct several locators that will each target the same element, using different selector strategies. Each of these locators can be used in an Appium test.
Using content-desc (AccessibilityId)
The content-desc attribute can be used as an AccessibilityId:
driver.findElement(AppiumBy.accessibilityId("myButton"));
Using text
The text attribute can be used as a name:
driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().text(\"my-button\")"));
Using resourceId
The resourceId attribute can be used as an id:
driver.findElement(AppiumBy.id("com.testingbot.test:id/mybutton"));
Using class
The class attribute can be used as a className:
driver.findElement(AppiumBy.className("android.widget.Button"));
Using UIAutomatorViewer with TestingBot
Using UIAutomatorViewer allows you to find the locators you need for your tests.
You can make sure your test automation stays functioning by choosing the right locators. The right locators are the most simple locators, which are not likely to change during the lifetime of the app.
For example, instead of choosing a resourceId, it might make more sense to assign the element a specific AccessibilityId which will not change.
TestingBot offers manual mobile app testing, which offers a Mobile Inspector. The Mobile Inspector allows you to inspect the view hierarchy of your app and find locators, similar to how UIAutomatorViewer works.