[SOLVED] ANDROID_HOME error even after being set

Hello, I’m trying to run some tests on my android device and keep getting the following error:


I’ve looked into several solutions offered on various forums. At first I set my variables under ~/.bash_profile but later discovered that being on MacOS Monterey, I should instead use ~/.zprofile. So I set my variables there, and even set them on ~/.zshenv out of frustration but it’s still not working.
This is what I have set:
export JAVA_HOME=$(/usr/libexec/java_home)
export ANDROID_HOME=/Users/clement/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/cmdline-tools/latest/bin:$PATH
export PATH=$ANDROID_HOME/build-tools/:$PATH
export PATH=$ANDROID_HOME/emulator:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH

With echo $ANDROID_HOME, I can see the path being returned properly, and when I use appium-doctor it’s all good too:


But if I then try to run my test, or even just use the Appium Inspector to connect to my device, it’s throwing the error again.
I’m really not sure what else to do, I’ve looked in so many forums and tried so many different solutions but nothing worked :frowning:
Has anyone ever encountered this or has a potential solution?
Thank you very much

Is the top screenshot from Inspector? Also, what version of Appium server are you using? I do see that:

android could NOT be found in /Users/clement/Library/Android/sdk!

Could that be part of the problem?

That top screenshot is from Terminal. I’m on appium v1.22.3.
I saw that error too but looking a bit further into it, seems like it’s just deprecated?
I’ve tried with Android studio too, this is what I’ve got but still no luck:

It’s easier to look at the terminal.

I think you are running into this issue:

https://stackoverflow.com/questions/21038903/path-variable-in-zshenv-or-zshrc#34244862

There are a couple of solutions in there but this one looks like the most “Mac” way of solving it:

https://www.softec.lu/site/DevelopersCorner/MasteringThePathHelper

1 Like

That was it! Thank you so much! Made changes accordingly to what’s described in the second link and it’s all good now! :smiley: