android / android-test

An extensive framework for testing Android apps
https://android.github.io/android-test
Apache License 2.0
1.15k stars 310 forks source link

UIAUTOMATORVIEWER: SWT folder does not exist on MAC #1243

Closed walidsabir closed 2 years ago

walidsabir commented 2 years ago

Description

Hi there, When I try to run UIAUTOMATORVIEWER I get the following error:

**

SWT folder '/Users/XXXX/Library/Android/sdk/tools/lib/aarch64' does not exist.

Please export ANDROID_SWT to point to the folder containing swt.jar for your platform.

**

Here's my bash profile

**

export JAVA_HOME=$(/usr/libexec/java_home)

export PATH=${JAVA_HOME}/bin:$PATH

export ANDROID_HOME=/Users/$(whoami)/Library/Android/sdk

export PATH=$PATH:/usr/local/git/bin:/usr/local/bin:

export PATH=$PATH:$ANDROID_HOME/platforms-tools

export PATH=$PATH:$ANDROID_HOME/tools

export PATH=$PATH:$ANDROID_HOME/tools/bin

export PATH=$PATH:$ANDROID_HOME/emulator

export PATH=$PATH:$ANDROID_HOME/tools/lib

**

Here's my Java version:

**

java version "17.0.1" 2021-10-19 LTS

Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)

Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

**

Here's my Mac info: Mac OS Big Spur, M1 ship

Thank you

Steps to Reproduce

Expected Results

Actual Results

AndroidX Test and Android OS Versions

Link to a public git repo demonstrating the problem:

brettchabot commented 2 years ago

This repository is for issues with the android.test libraries not studio tools. I'd suggest to file this bug into https://source.android.com/setup/contribute/report-bugs 'Android Studio"

ManishaJoshi-mj commented 2 years ago

Hello, facing the same issue yet. let me know if anybody finds the solution for this.

thouger commented 2 years ago

same problem,see like incompatible m1

meghavinay0309 commented 2 years ago

I am facing similar issue. Tried to export path of ANDROID_SWT but its not working!

tahir-akhlaq commented 2 years ago

Any Solution for this

jlmalone commented 2 years ago

I experience this also. Please let me know if a solution is found

ManishaJoshi-mj commented 2 years ago

No solution found! Waiting for android team devs to look into this issue.

On Mon, 2 May 2022 at 10:44, jlmalone @.***> wrote:

I experience this also. Please let me know if a solution is found

— Reply to this email directly, view it on GitHub https://github.com/android/android-test/issues/1243#issuecomment-1114504107, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHLNTKDAZN3IGXQOBJELMKLVH5QC5ANCNFSM5MGRCELQ . You are receiving this because you commented.Message ID: @.***>

--

Thanks & Regards, Manisha Joshi | Developer- iOS Cell / Whatsapp : +91- 7987609280 Skype: manishajoshi082014

singulart commented 2 years ago

Same problem on mac book pro with apple silicon M1 Pro

karlajusten commented 2 years ago

I'm facing the same issue. I use mac book pro with apple silicon M1 Pro

vipost28 commented 2 years ago

I managed to solve this by adding JAVA_HOME path in my .zshrc file (I'm using MBP m1): export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home

Before I had this path and it didn't work: export JAVA_HOME=$(/usr/libexec/java_home)

But it's very important to download JDK SE from Oracle web site (it's called something like "jdk-8u333-macosx-x64"). Before I had Java 18 installed and it seems like it didn't work.

So now all related paths in the . zshrc file are: export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_333.jdk/Contents/Home export DEVICE='android' export ANDROID_HOME=/Users/username/Library/Android/sdk export PATH=$ANDROID_HOME/platform-tools:$PATH export PATH=$ANDROID_HOME/build-tools:$PATH export PATH=$ANDROID_HOME/tools:$PATH export PATH=$ANDROID_HOME/emulator:$PATH

export PATH=${JAVA_HOME}/bin:$PATH export PATH=${PATH}:/$ANDROID_HOME/platform-tools:/$ANDROID_HOME/tools:/$ANDROID_HOME/tools/bin


I guess that the last are not needed, but I'm not really experienced, so I leave these in the paths as well. So now

yuhuazhu commented 2 years ago

the same issues with mba m1 when i use oracle jdk8,not zulu jdk,uiautomatorviewer is work

ViktorVoin commented 1 year ago

I managed to solve this by adding JAVA_HOME path in my .zshrc file (I'm using MBP m1): export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home

Before I had this path and it didn't work: export JAVA_HOME=$(/usr/libexec/java_home)

But it's very important to download JDK SE from Oracle web site (it's called something like "jdk-8u333-macosx-x64"). Before I had Java 18 installed and it seems like it didn't work.

So now all related paths in the . zshrc file are: export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_333.jdk/Contents/Home export DEVICE='android' export ANDROID_HOME=/Users/username/Library/Android/sdk export PATH=$ANDROID_HOME/platform-tools:$PATH export PATH=$ANDROID_HOME/build-tools:$PATH export PATH=$ANDROID_HOME/tools:$PATH export PATH=$ANDROID_HOME/emulator:$PATH

export PATH=${JAVA_HOME}/bin:$PATH export PATH=${PATH}:/$ANDROID_HOME/platform-tools:/$ANDROID_HOME/tools:/$ANDROID_HOME/tools/bin

I guess that the last are not needed, but I'm not really experienced, so I leave these in the paths as well. So now

This work for Mac air M1.

tilalapradip commented 1 year ago

This reference helped me to fix this issue on My MacBook pro m1, https://www.youtube.com/watch?v=raG9TJWKxR4

juanmendez commented 1 year ago

This reference helped me to fix this issue on My MacBook pro m1, https://www.youtube.com/watch?v=raG9TJWKxR4

confirming this worked for me as of now.

Initially it wasn't working because I had java_home set to Android Studio in my ~/.zshrc

export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"

I made sure to point to another jvm I had already installed..

export JAVA_HOME="/Users/me/Library/Java/JavaVirtualMachines/corretto-1.8.0_322/Contents/Home"

Possibly in anyone's case point to the java_home set by default.

I am just glad there is a way to get this fixed because I really miss this automator for several years already.

TarCV commented 1 year ago

I've made a fork of uiautomatorviewer because of similar issues - https://github.com/TarCV/uiautomatorviewer-gradle Works good for me so far. Hope it would be useful for others too.

TWiStErRob commented 1 year ago

Re: the closing https://github.com/android/android-test/issues/1243#issuecomment-1031755604

There are numerous similar issues open on the Google IssueTracker, followers might want to vote these if they're affected.

Also I think uiautomatorviewer might've been been discontinued as a tool, because it didn't exist in the latest SDK: https://stackoverflow.com/a/75631434/253468.

in509 commented 11 months ago

For me another prerequisite is it's also depends on the JDK version, for me the 1.8.0.331 working well, however 1.8.0.381 doesn't

rcmrlzl commented 10 months ago

I managed to solve this by adding JAVA_HOME path in my .zshrc file (I'm using MBP m1): export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home

Before I had this path and it didn't work: export JAVA_HOME=$(/usr/libexec/java_home)

But it's very important to download JDK SE from Oracle web site (it's called something like "jdk-8u333-macosx-x64"). Before I had Java 18 installed and it seems like it didn't work.

So now all related paths in the . zshrc file are: export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_333.jdk/Contents/Home export DEVICE='android' export ANDROID_HOME=/Users/username/Library/Android/sdk export PATH=$ANDROID_HOME/platform-tools:$PATH export PATH=$ANDROID_HOME/build-tools:$PATH export PATH=$ANDROID_HOME/tools:$PATH export PATH=$ANDROID_HOME/emulator:$PATH

export PATH=${JAVA_HOME}/bin:$PATH export PATH=${PATH}:/$ANDROID_HOME/platform-tools:/$ANDROID_HOME/tools:/$ANDROID_HOME/tools/bin

I guess that the last are not needed, but I'm not really experienced, so I leave these in the paths as well. So now

works for me! macbook air m1 (I changed my jdk from "jdk-8u381-macosx-aarch64" to "jdk-8u202-macosx-x64")

kenyee commented 8 months ago

This hack from this blog works: https://blog.i1nfo.com/posts/uiautomatorviewer/index.html#Preparations But I keep getting an error of "Error taking device screenshot: EOF".

pmaheshchauhan commented 6 months ago

I am having macbook m3 pro tried all the above things still unable to start the ui automatorviewer Could some one help me on this one

nauman404 commented 2 months ago

All above tricks didn't work for me on M3 MBP.