2

The problem

The whole GUI is broken. No messages, no texts in the buttons, weird symbols, etc.
I think it might be the SWT (see image).

Environment

  • Desktop OS: macOS Catalina 10.15.4 (19E287)

  • Mobile platform/version under test: Android

  • Real device or emulator/simulator: Emulated device via Android Studio QEMU

  • Java: Installed Java with brew.

    openjdk version "1.8.0_252"
    OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_252-b09)
    OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.252-b09, mixed mode)

  • Android Studio Installed from official webpage.

    Android Studio 4.0
    Build #AI-193.6911.18.40.6514223, built on May 20, 2020
    Runtime version: 1.8.0_242-release-1644-b3-6222593 x86_64
    VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
    macOS 10.15.4
    GC: ParNew, ConcurrentMarkSweep
    Memory: 1237M
    Cores: 12
    Registry: ide.new.welcome.screen.force=true
    Non-Bundled Plugins:

Steps to reproduce

  1. Install Java 8
  2. Install Android Studio
  3. Install Intel HAXM
  4. Run from terminal uiautomatorviewer or /Users/user/Library/Android/sdk/tools/bin/uiautomatorviewer

Enviroment variables

export JAVA_HOME_8=$(/usr/libexec/java_home -v 1.8)

export JAVA_HOME=$JAVA_HOME_8
export PATH=$PATH:$JAVA_HOME/bin

export M2_HOME=/opt/apache-maven-3.6.3
export PATH=$PATH:$M2_HOME/bin

export ANDROID_HOME=/Users/user/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/build-tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin

Maybe I'm missing something. Also, if logs are needed please tell me.
Thanks

e3roll
  • 23
  • 6
  • Apple recently ditched 32-bit support, which might be the cause. So far the OS version is the only relevant information; try running it from the console in order to eventually get more output. Sadly I can't tell how to list the libraries a binary is linked against, but there might be such command, too. – Martin Zeitler May 25 '20 at 06:56
  • I'm running it from the terminal. I searched for a verbose output, a debug mode and for a log file but found nothing. Thanks anyway. – e3roll Jun 04 '20 at 22:51

6 Answers6

3

If you are using dark mode, can you try switching your macOS theme to light mode? I got a Java update dialog which looked similar to your screenshot. I realized the texts were there but they were white and couldn't be seen over a white window background. I realized this when I clicked on a button.

Java update dialog

1

You must change to Light mode appearance in your Mac setting

Rocal
  • 111
  • 1
  • 4
0

I had the same problem. I was able to fix it by switching from adoptopenjdk to using Java 1.8.0_231. Could be that the problem is the different GUI they use in adoptopenjdk vs oracle. From adoptopenjdk FAQ "For JDK8, AdoptOpenJDK is using an open-source renderer called Pisces. " Hope that helps.

jman312
  • 1
  • 2
0

MAC solution:

The only way to make this tool uiautomatorviewer work was by following this Youtube video, where you have to go to this Eclipse website, and download the release 4.20 (newer releases didn't work). Once you click on the 4.20 release, scroll all the way to the bottom to the section SWT Binary and Source and download the one compatible with your mac (mine was swt-4.20-cocoa-macosx-x86_64.zip). Open the zip folder and rename the file swt.jar to swt2.jar. Next, go to your /tools/bin folder Open the folders x86 and x86_64 and paste that swt2.jar file inside. Restart your Terminal and try to open uiautomatorviewer again.

NOTE: when you open it the first time, the minimize, maximize buttons will work, but you wont see the buttons to capture a screenshot. Just click maximize and minimize and that will make them show up.

Benny
  • 1,650
  • 17
  • 20
0

Broken UiAutomator GUI

  1. uiautomatorviewer comes built-in with Android SDK - /opt/homebrew/Caskroom/android-sdk/tools/bin/uiautomatorviewer
  2. Execute in that directory using ./uiautomator (If needed use sudo for permission)
  3. If the UI opens but broken, go to https://download.eclipse.org/eclipse/downloads/index.html and download(4.20 or 4.19 works) -> Under "SWT Binary and Source" download for your platform (For mac M1, swt-4.19-cocoa-macosx-x86_64.zip)
  4. Extract the zip file and rename swt.jar to swt2.jar
  5. Paste swt2.jar file in x86 and x86_64 directories. /opt/homebrew/Caskroom/android-sdk/tools/lib/x86 /opt/homebrew/Caskroom/android-sdk/tools/lib/x86_64
  6. Now open terminal, go to /opt/homebrew/Caskroom/android-sdk/tools/bin/ and run uiautomatorviewer $ sudo ./uiautomatorviewer
0

For me, on my Mac, once the uiautomatorviewer window opened, the toolbar which has icons to take screenshot/capture UI hierarchy was not showing. After resizing the windows, the toolbar starts showing. Go figure...

vdoublek
  • 26
  • 4