preetam
preetam

Reputation: 1

Error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported

For my automation scripts, I am trying to programmatically launch Appium and then run the automation codes in the Emulator (already open).

For launching Appium, I am using below code: AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder().usingDriverExecutable(new File(nodePath)).withAppiumJS(new File(appiumPath)).withIPAddress("127.0.0.1") .usingPort(4723)); service.start();

Once the Appium is successfully launched with 200 response and the capabilities are loaded, I am facing the error as "Error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported.

Please help.

Upvotes: 0

Views: 3438

Answers (2)

Aman Bhutani
Aman Bhutani

Reputation: 11

I created a .zshenv profile since, after macOS 13, it is unable to read ANDROID_HOME and ANDROID_SDK_ROOT values from bash profile. So, copy all .bash_profile values in to your .zshenv profile. Also, add the below statement to your .zshenv profile.

export ANDROID_SDK_ROOT=$ANDROID_HOME

After that, restart your intelliJ, Android Studio, and Terminal.

Upvotes: 0

Bilal
Bilal

Reputation: 588

You need to add following in your IDE's environment variables:

ANDROID_HOME=/Users/"your_user_name"/Library/Android/sdk

Please tailor the above to your own path if it's different.

Upvotes: 0

Related Questions