Akhlesh vishnoi
Akhlesh vishnoi

Reputation: 141

Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported

I am trying to start a session in Appium, but I am getting an error:

An unknown server-side error occurred while processing the command. Original error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported

The OS I am using is Window 10.

enter image description here

Upvotes: 14

Views: 79582

Answers (6)

superman
superman

Reputation: 251

In the main UI, select "Edit Configurations", set the requested variables, and then restart Appium.

enter image description here

Upvotes: 24

dhan bycode
dhan bycode

Reputation: 11

Problem :

An unknown server-side error occurred while processing the command. Original error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported

If your typing appium-doctor on terminal will get error on path ANDROID_HOME -> X and not check just like this :

info AppiumDoctor Appium Doctor v.1.16.0
info AppiumDoctor ### Diagnostic for necessary dependencies starting ###
info AppiumDoctor  ✔ The Node.js binary was found at: /Users/wiwa/.nvm/versions/node/v16.17.0/bin/node
info AppiumDoctor  ✔ Node version is 16.17.0
info AppiumDoctor  ✔ Xcode is installed at: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor  ✔ Xcode Command Line Tools are installed in: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor  ✔ DevToolsSecurity is enabled.
info AppiumDoctor  ✔ The Authorization DB is set up properly.
info AppiumDoctor  ✔ Carthage was found at: /usr/local/bin/carthage. Installed version is: 0.38.0
info AppiumDoctor  ✔ HOME is set to: /Users/wiwa
info AppiumDoctor  ✖ ANDROID_HOME is set to: /Users/wiwa/Library/Android/sdk
info AppiumDoctor  ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
info AppiumDoctor    Checking adb, android, emulator
info AppiumDoctor      'adb' is in /Users/wiwa/Library/Android/sdk/platform-tools/adb
info AppiumDoctor      'android' is in /Users/wiwa/Library/Android/sdk/tools/android
info AppiumDoctor      'emulator' is in /Users/wiwa/Library/Android/sdk/emulator/emulator
info AppiumDoctor  ✔ adb, android, emulator exist: /Users/wiwa/Library/Android/sdk
info AppiumDoctor  ✔ 'bin' subfolder exists under '/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home'
info AppiumDoctor ### Diagnostic for necessary dependencies completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor ### Diagnostic for optional dependencies starting ###
WARN AppiumDoctor  ✖ opencv4nodejs cannot be found.
info AppiumDoctor  ✔ ffmpeg is installed at: /usr/local/bin/ffmpeg. ffmpeg version 5.1 Copyright (c) 2000-2022 the FFmpeg developers
WARN AppiumDoctor  ✖ mjpeg-consumer cannot be found.
WARN AppiumDoctor  ✖ set-simulator-location is not installed
WARN AppiumDoctor  ✖ idb and idb_companion are not installed
WARN AppiumDoctor  ✖ applesimutils cannot be found
info AppiumDoctor  ✔ ios-deploy is installed at: /Users/wiwa/.nvm/versions/node/v16.17.0/bin/ios-deploy. Installed version is: 1.11.4
WARN AppiumDoctor  ✖ bundletool.jar cannot be found
WARN AppiumDoctor  ✖ gst-launch-1.0 and/or gst-inspect-1.0 cannot be found
info AppiumDoctor ### Diagnostic for optional dependencies completed, 7 fixes possible. ###
info AppiumDoctor
info AppiumDoctor ### Optional Manual Fixes ###
info AppiumDoctor The configuration can install optionally. Please do the following manually:
WARN AppiumDoctor  ➜ Why opencv4nodejs is needed and how to install it: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md
WARN AppiumDoctor  ➜ mjpeg-consumer module is required to use MJPEG-over-HTTP features. Please install it with 'npm i -g mjpeg-consumer'.
WARN AppiumDoctor  ➜ set-simulator-location is needed to set location for Simulator. Please read https://github.com/lyft/set-simulator-location to install it
WARN AppiumDoctor  ➜ Why idb is needed and how to install it: https://github.com/appium/appium-idb
WARN AppiumDoctor  ➜ Why applesimutils is needed and how to install it: http://appium.io/docs/en/drivers/ios-xcuitest/
WARN AppiumDoctor  ➜ bundletool.jar is used to handle Android App Bundle. Please read http://appium.io/docs/en/writing-running-appium/android/android-appbundle/ to install it
WARN AppiumDoctor  ➜ gst-launch-1.0 and gst-inspect-1.0 are used to stream the screen of the device under test. Please read https://appium.io/docs/en/writing-running-appium/android/android-screen-streaming/ to install them and for more details
info AppiumDoctor
info AppiumDoctor ###
info AppiumDoctor
info AppiumDoctor Bye! Run appium-doctor again when all manual fixes have been applied!
info AppiumDoctor

so for solution if your using mac or linux use .bashrc or .zshrc just typing :

source ~/.bashrc

or

source ~/.zshrc

And check again use appium-doctorif already check for ANDROID_HOME its already solved without error :)

Upvotes: 1

preetam
preetam

Reputation: 1

I am facing the same issue in Mac. I am trying to launch Appium programmatically which is successful through AppiumDriverLocalService.

Once Appium is launched, and all the capabilities are loaded, when I am trying to set the driver (AppriumDriver), it gives me the error as "org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported. Read https://developer.android.com/studio/command-line/variables for more detail"

Upvotes: 0

Suresh
Suresh

Reputation: 835

If you have just updated the rc file with ANDROID_HOME, be sure to restart the cli appium server in a new window. A previously launched appium server will keep complaining.

Upvotes: 2

sajid912
sajid912

Reputation: 21

I had the same problem. All the environment variables were set right already. I found the root cause to be the unfinished process running in port 4723 at Host 0.0.0.0 when I force quit the Appium Desktop application. Once I killed the process running at this address, I did not see the problem anymore

Link to kill the address in use: Appium Question. If "listen eaddrinuse: address already in use", how to stop it? why it didn't stop?

Upvotes: 2

samson ojo
samson ojo

Reputation: 169

I have also run into this issue. What I noticed is that most time is you are actually setting your ANDROID_HOME but you are missing a spelling in the value. Check and ensure you copy the path instead of typing the path because when you type it you are likely going to misspell android spelling. So, copy the path of your Android installation into your system variable's Name/Value pair.

enter image description here

Upvotes: 0

Related Questions