Problem when trying to run uiautomatorviewer

I want to run Android studio Uiautomatorviewer on Manjaro Linux but it says there is no SWT found.
I want to install SWT using:

yay -S swt

but it says there is no Cairo found.
I installed the cairo using:

yay -S cairo

but when I want to install the SWT, again it says there is no cairo.
I want to install Cairo from the source but then it says there is no lzo2 and libpng found.
I installed the two libs but again Cairo can’t build because of these two libs.

how can I fix this problem?
Thank you for your help!

Hi,

I checked cairo with pacman.

[nls@lap ~]$ sudo pacman -S cairo
[sudo] password for nls: 
warning: cairo-1.18.0-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) cairo-1.18.0-1

Total Installed Size:  1,59 MiB
Net Upgrade Size:      0,00 MiB

:: Proceed with installation? [Y/n] n
[nls@lap ~]$ 

I found swt, the open source widget toolkit for java, found in the AUR with pamac

1 Like

yes that is there, but pamac couldn’t build it:

Preparing...
Cloning swt build files...
Generating swt information...
Checking swt dependencies...
Resolving dependencies...
Checking inter-conflicts...

Building swt...
==> Making package: swt 4.28-2 (Sun 15 Oct 2023 01:01:40 PM +0330)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found swt-4.28-gtk-linux-x86_64.zip
  -> Found build-swt.xml
==> Validating source files with sha256sums...
    swt-4.28-gtk-linux-x86_64.zip ... Passed
    build-swt.xml ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
==> Starting prepare()...
==> Removing existing $pkgdir/ directory...
==> Starting build()...
Buildfile: /var/tmp/pamac-build-hami/swt/src/build-swt.xml

init:
   [tstamp] Honouring environment variable SOURCE_DATE_EPOCH which has been set to 1697362300
    [mkdir] Created dir: /var/tmp/pamac-build-hami/swt/src/build

compile:
    [javac] Compiling 452 source files to /var/tmp/pamac-build-hami/swt/src/build
    [javac] javac: invalid source release: 11
    [javac] Usage: javac <options> <source files>
    [javac] use -help for a list of possible options

BUILD FAILED
/var/tmp/pamac-build-hami/swt/src/build-swt.xml:11: Compile failed; see the compiler error output for details.

Total time: 0 seconds
==> ERROR: A failure occurred in build().
    Aborting...

Check you have prerequisites installed:

If you bothered to investigate why it fails - by reading the error message - applying some developer logic …

Then you find this

Which indicates an unsupported java source version

Then you should check which jdk is required, install it and use archlinux-java to set the active jdk.

1 Like

Hey, I had the following problem with UIAutomatorViewer:

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)

And solve it you simply need to install these packages (they are not in AUR):

sudo pacman -S gtk2 gtk-engine-murrine

Hope this helps!