Hello, I made a simple instruction on how to fix some Android's UIAutomatorViewer errors which I have encountered on my machine. Here it is:
-Djava.ext.dirs=/home/user/Android/Sdk/tools/lib/x86_64:/home/user/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.
This error happens if your machine doesn't have Java 8 version set as system default. UIAutomatorViewer sadly works only with Java 8. To fix this problem install Java 8 and set it as default version.
For Arch Linux:
sudo pacman -S jdk8-openjdk
sudo archlinux-java set java-8-openjdk
Problem solved ๐
2. UnsatisfiedLinkError: no swt-pi-gtk-3550 or swt-pi-gtk in swt.library.path, java.library.path or the jar file
Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3550 or swt-pi-gtk in swt.library.path, java.library.path or the jar file
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.gtk.OS.<clinit>(Unknown Source)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
at org.eclipse.swt.widgets.Widget.isValidSubclass(Unknown Source)
at org.eclipse.swt.widgets.Decorations.checkSubclass(Unknown Source)
at org.eclipse.swt.widgets.Shell.<init>(Unknown Source)
at org.eclipse.swt.widgets.Shell.<init>(Unknown Source)
at org.eclipse.jface.window.Window.createShell(Window.java:487)
at org.eclipse.jface.window.Window.create(Window.java:430)
at org.eclipse.jface.window.Window.open(Window.java:790)
at com.android.uiautomator.UiAutomatorViewer.main(UiAutomatorViewer.java:78)
You need to install gtk2
and gtk-engine-murrine
dependencies.
For Arch Linux:
sudo pacman -S gtk2 gtk-engine-murrine
Problem solved ๐