2

I am currently trying to learn about Appium Automated Testing. Everything is setup perfectly on my Mac.

All my environmental variables are set up correctly :

export ANDROID_HOME=/Users/abc/Library/Android/sdk

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

However when I run the eclipse program, eclipse throws an error saying:

remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not find 'aapt' in ["/usr/local/share/android-sdk/platform-tools/aapt","/usr/local/share/android-sdk/emulator/aapt","/usr/local/share/android-sdk/tools/aapt","/usr/local/share/android-sdk/tools/bin/aapt"]. Do you have Android Build Tools installed at '/usr/local/share/android-sdk'?

So my question is why eclipse is looking for Android SDK tools in usr/local , my sdk tools are located in

/Users/abc/Library/Android/sdk.

How can I tell eclipse to look for the appt,adb, etc in my User folder and not the admin usr folder.

Sagar
  • 416
  • 7
  • 23

3 Answers3

0

My expectation is that your PATH variable has /usr/local/share/android-sdk/emulator/aapt entry and it is resolved before your additions of the ANDROID_HOME variable.

So either remove that Android SDK which lives under /usr/local/share/android-sdk/ from your operating system like:

brew cask uninstall android-sdk

or amend your PATH variable definition so your "good" Android SDK installation goes before anything else like:

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

See Appium Java Code examples for more information regarding proper setup of Appium environment. You might also want to check the integrity of the infrastructure setup using appium-doctor

appium-doctor --android
Dmitri T
  • 159,985
  • 5
  • 83
  • 133
0

I just struggled with on MacOS Catalina 10.15.3, Appium 1.10.1, Appium Doctor v.1.13.0 trying to set up Android with Appium.

Make sure you are changing the correct file. You have 3 possible locations.

~/.bash_profile

~/.profile

~/.zshrc

I was editing my ~/.bash_profile instead of ~/.zshrc you can have a situation where you are setting the correct path but not in the right file.

If your trying to get going with Android Appium in Mac here is what I put in my ~/.zshrc at the bottom

# Android Paths for Appium
export ANDROID_HOME=/Users/**PUT_YOUR_USER_NAME_HERE_WITHOUT_STARS**/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform_tools
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=${JAVA_HOME}/bin:$PATH

Also if you don't want to edit in a terminal-based editor use the following command to open the files in a text editor.

open -e .bash_profile

open -e .zshrc

open -e .profile

After editing do not forget to save.

Quit your Terminal.

Run Appium_Doctor

The following post helped me out a lot when setting up my Appium

appium-workshop/Appium Mac Installation Instructions

https://github.com/isonic1/appium-workshop/blob/master/Appium%20Mac%20Installation%20Instructions.md

ST215
  • 1
  • 2
0

If you have a system-wide eclipse installation, it usually won't read your environment variables from your .bashrc or .bashprofile, but from /etc/environment.

If you don't want to modify this file, or if it doesn't exist on a Mac, then you can always set the variables at a project level. This is done in the "Environment" tab of the configuration (run, debug, external tools,...) you're running within Eclipse, like this:

enter image description here

gvisoc
  • 77
  • 3