Created
February 20, 2026 15:35
-
-
Save paragbaxi/3c1b53544f6ce347108a2a7de43f598a to your computer and use it in GitHub Desktop.
Launch uiautomatorviewer-gradle on macOS (Apple Silicon / JDK 17) without crashing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Launch uiautomatorviewer-gradle on macOS with JDK 17 | |
| # Without JAVA_HOME + -XstartOnFirstThread, the app crashes immediately on macOS. | |
| # | |
| # Source: https://github.com/pvmagacho/uiautomatorviewer-gradle | |
| # Fix: https://github.com/paragbaxi/uiautomatorviewer-gradle | |
| # 1. Build | |
| ./gradlew -Dorg.gradle.java.home="/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home" installDist | |
| # 2. Launch | |
| JAVA_HOME="/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home" \ | |
| JAVA_OPTS=-XstartOnFirstThread \ | |
| ./build/install/uiautomatorviewer-gradle/bin/uiautomatorviewer-gradle | |
| # Note: -XstartOnFirstThread is macOS-only and cannot be added to the shell wrapper script, | |
| # so it must be passed via JAVA_OPTS at launch time. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment