uiautomatorviewer - Error: Could not create the Java Virtual Machine : <p>I am trying to run <code>uiautomatorviewer</code> in terminal. I am getting this error:</p>

<pre><code>-Djava.ext.dirs=/Users/&lt;Username&gt;/Library/Android/sdk/tools/lib/x86_64:/Users/&lt;Username&gt;/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.
</code></pre>

<p>I think this might be related to the java version I am using. Here is the output of <code>java -version</code>:</p>

<pre><code>java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode)
</code></pre>

<p>I have already seen <a href="https://stackoverflow.com/questions/47029810/uiautomatorviewer-could-not-create-java-virtual-machine">this question on SO</a>, but it recommends downgrading to java 8.</p>

<p>Am I missing anything here? I would appreciate any help.</p>
