Issue
When running uiautomatorviewer
, I am getting the following NullPointerException
error:
src="https://i.stack.imgur.com/u7Sy4.png" alt="enter image description here">
I have installed and set up Appium following the setup process and set up environment variables for ANDROID_HOME and the Android SDK. The uiautomatorviewer
command is using a Path user variable that points to the directory Sdk/tools/bin
, where the uiautomatorviewer.bat
file is located. From everything I've read online, running this executable should open up the UiAutomatorViewer application so I can inspect elements on my Android app. I'm looking for any ideas on why this isn't working.
Any more tips on tools to inspect elements in Android apps are welcome.
Let me know if any more information is needed. Thank you!
Solution
The correct fix for this issue:
Java SDKs 9 and 10 do not work with Appium and the Android SDK. You have to uninstall the Java SDK for the more recent version and install the Java 8 SDK instead.
For Linux
Follow this process:
brew cask uninstall java # uninstall java9
brew tap caskroom/versions
brew cask install java8 # install java8
touch ~/.android/repositories.cfg # without this file, error will occur on next step
brew cask install android-sdk
For Windows
- Open Add or Remove Programs menu and uninstall Java 9/10.
- Install Java 8 using the installer.
Answered By - Jeremy Hadfield
Answer Checked By - David Goodson (JavaFixing Volunteer)