1

I am unable to start uiautomatorviewer due to below error:

C:\Users\176226\AppData\Local\Android\Sdk\tools\bin>uiautomatorviewer
-Djava.ext.dirs=..\lib\x86_64;..\lib is not supported.  Use -classpath instead.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I have added all the needed paths for tools, cmd-tools and platform tools and android_home in env variables

below are details of java version used. Can uiautomator be used without having to downgrade java version:

openjdk version "17.0.2" 2022-01-18 LTS
OpenJDK Runtime Environment Zulu17.32+13-CA (build 17.0.2+8-LTS)
OpenJDK 64-Bit Server VM Zulu17.32+13-CA (build 17.0.2+8-LTS, mixed mode, sharing)

Appreciate help

  • I changed java version to : C:\Users\176226>java -version openjdk version "1.8.0-262" OpenJDK Runtime Environment (build 1.8.0-262-b10) OpenJDK 64-Bit Server VM (build 25.71-b10, mixed mode)...But still have same issues – rohini dingankar Sep 01 '22 at 13:10

1 Answers1

0

this was a real adventure....

  1. download and install specifically JDK version 8 (not JRE or any other version) https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html

  2. add JDK8 to your environemnt path as JAVA_HOME..for example: enter image description here

  3. make sure %ANDROID_HOME%\tools\bin is also added to your Path as well so that you can run uiautomatorviewer from any directory enter image description here

  4. in terminal, run uiautomatorviewer

Eric
  • 16,397
  • 8
  • 68
  • 76