I’m working with Appium C# in MacOS environment but when I try run my current code for Android device had as result “Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported.Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported.”
I verified that environment variables have set correctly and those are correctly set, when I run echo $ANDROID_HOME return me the correct value:
/Users/admin/Library/Android/sdk
I verified too in Visual Studio the configuration and set in Tools - Preferences - SDK Locations - Android and verify in Tools - Preferences - Tools for Unity - General and put the path of Android Studio in the option ‘Preferred Android SDK root’
Specific Error:
OpenQA.Selenium.WebDriverException : 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 details
Versions
MacOS Ventura: 13.5
Visual Studio 17.6.3
Android Studio 2022.3.1 Giraffe
I don’t know why appears the error when try to run my test from code, when I launch Appium Server Gui and Appium Inspector all works good, but from code doesn’t work.
Yes sir it is from Visual Studio for Mac, I tried run the test cases from Terminal using the dotnet test command and does not appear the error I sailed on the title of the this post
Example command: dotnet test /Users/{YOURPATH}/{YOURPROJECT}.dll
I encountered a similar situation on Linux, where after setting up the environment variables, it is necessary to restart Appium. If the terminal in which Appium is running does not update the $ANDROID_HOME variable, the Appium Inspector will keep prompting this error.