'My UIautomator is not starting in mac. I have done everything possible

I am learning appium and I have set up everything that is required. I have setup paths, installed android studio, run appium and created a virtual android device too. But when i am writing uiautomatorviewer its giving me an error

mac@Macs-MacBook-Pro ~ % uiautomatorviewer                                    
-Djava.ext.dirs=/Users/mac/Library/Android/sdk/tools/lib/x86_64:/Users/mac/Library/Android/sdk/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.
mac@Macs-MacBook-Pro ~ % 

Can anyone help me please



Solution 1:[1]

A. I encountered this issue once, sometime env var doesn't load and it throws error, open and load bash profile and run that command.

  1. open ~/.bash_profile
  2. source ~/.bash_profile
  3. uiautomatorviewer

B. if appium server is running, try to close it and run the command.

Solution 2:[2]

Try the following command:

sudo ./uiautomatorviewer

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 rakeshsahu59
Solution 2 Wai Ha Lee