Unable to start uiautomatorviewer on Ubuntu
Finally I was able to find out a solution , so just posting the same for other's reference :
Downgrading the Java version from 9 to 8 resolved the issue :
Command Used :
sudo update-alternatives --config java
This is list out the version installed like this with * on the selected version :
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-9-openjdk-amd64/bin/java 1091 auto mode
* 1 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
2 /usr/lib/jvm/java-9-openjdk-amd64/bin/java 1091 manual mode
Press <enter> to keep the current choice[*], or type selection number:
Enter here the number 1 as we need version 8 .
Thats's all done , rerun uiautomatorviewer .
EDIT:
If You see something like "you don't have any alternatives" try donwloading openjdk-8 from the link below (for linux)
Install open jdk-8