You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在M1芯片Mac上运行UI Automator Viewer?

在M1芯片Mac上运行UI Automator Viewer的解决方法

针对你遇到的M1 Mac上无法启动UI Automator Viewer GUI的问题,以下是经过验证的可行方案:

方案一:通过Rosetta 2转译运行

  1. 先安装Rosetta 2(如果未安装):
    softwareupdate --install-rosetta
    
  2. 用Rosetta强制以x86架构运行uiautomatorviewer:
    arch -x86_64 /Users/{username}/Library/Android/sdk/tools/bin/uiautomatorviewer
    
    替换{username}为你的系统用户名。

方案二:修改uiautomatorviewer脚本(永久生效)

  1. 打开uiautomatorviewer脚本文件:
    open -e /Users/{username}/Library/Android/sdk/tools/bin/uiautomatorviewer
    
  2. 找到脚本中PLATFORM相关的判断逻辑,将其强制指定为x86_64:
    找到类似以下的代码段:
    # Determine the SWT folder
    case "`uname -s`" in
        Darwin)
            if [ "`uname -m`" = "x86_64" ]; then
                PLATFORM=x86_64
            else
                PLATFORM=x86
            fi
            ;;
        Linux)
            ...
    esac
    
    修改为:
    # Determine the SWT folder
    case "`uname -s`" in
        Darwin)
            PLATFORM=x86_64
            ;;
        Linux)
            ...
    esac
    
  3. 找到脚本末尾执行Java的exec命令行,在"$JAVA_CMD"前加上arch -x86_64,修改后类似:
    exec arch -x86_64 "$JAVA_CMD" "$@"
    
  4. 保存修改后,直接点击脚本或在命令行运行即可启动GUI。

方案三:使用替代工具

如果上述方法仍有问题,可以考虑使用Android Studio内置的Layout Inspector(路径:View > Tool Windows > Layout Inspector),它可以实现UI Automator Viewer的核心功能,且原生支持M1芯片。


内容的提问来源于stack exchange,提问作者memoryleaker

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 09:20:28