How to set ANDROID_HOME in MacOS
When i try to run my Appium script, i am getting following error.
Getting error 'Could not find adb Please set the ANDROID_HOME environment variable with the Android SDK root directory path.
Following is the full stacktrace
Exception in thread "main" org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not find adb Please set the ANDROID_HOME environment variable with the Android SDK root directory path. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 689 milliseconds
Build info: version: '2.47.1', revision: 'unknown', time: '2015-07-30 11:02:44'
System info: host: 'MacBook-Pro.local', ip: '127.0.0.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.2', java.version: '1.8.0_71'
Driver info: io.appium.java_client.android.AndroidDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:141)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:37)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:160)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:168)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:69)
at com.qentelli.mobe.AndroidInspector.main(AndroidInspector.java:26)
How to set ANDROID_HOME in MacOS?
1 Answer
7 years ago by Divya
Run the following command to set ANDROID_HOME in MacOS
echo export "ANDROID_HOME=/Users/<User Name>/Library/Android/sdk" >> ~/.bash_profile
Note: Replace <User Name>
with the user name.
Once done, restart the terminal, if you now run the following command you should see the value for ANDROID_HOME
echo $ANDROID_HOME
Output: /Users/<User Name>/Library/Android/sdk
7 years ago by Karthik Divi